Added a new set of country code conversion functions whose names match those for state and county conversions:

These are now preferred over the older codeToCountry() and countryToCode() functions which, while deprecated, are still supported for backwards compatibility.

  • Addressed CRAN package documentation issue.
  • Package-internal datasets can be loaded by getCountryCode() and getTimezone() without invoking library MazamaSpatialUtils.
  • Tweaks to satisfy CRAN submission checks.
  • Added dependency on sf.

This addresses the following error seen when using internal data in a dplyr context:

> IS <- SimpleCountriesEEZ %>% dplyr::filter(countryCode == "IS")
Error in `vec_size()`:
! `x` must be a vector, not a <sfc_MULTIPOLYGON/sfc> object.

This error is explained here: https://www.mm218.dev/posts/2022-12-01-sf-in-packages/ and the simplest solution for this spatially-oriented package is to simply move sf from an import to a dependency (by moving it to the “Depends:” section of DESCRIPTION).

  • Added handling of “Sparse geometry binary predicate list of length 1” error in getSpatialData() by simply choosing the first polygon returned.
  • Added convertWBDHUC() and pre-generated spatial data files: WBDHU2, WBDHU4, WBDHU6, WBDHU8 and WBDHU10.
  • Added getHUC() and getHUCName().

Added the following datasets to the archive at: http://data.mazamascience.com/MazamaSpatialUtils/Spatial_0.8/ * WBDHU2 (and simplified versions) * WBDHU4 (and simplified versions) * WBDHU6 (and simplified versions) * WBDHU8 * WBDHU10

  • Documentation fixes associated with change from sp to sf.
  • Tweaks to satisfy CRAN submission checks.

Version 0.8.x is a complete refactoring of MazamaSpatialUtils to upgrade from dependence on the sp package to use of the sf package. As much as possible, the suite of functions and arguments will remain the same.

The following changes have been made:

  • The dataset parameter has been renamed to datasetName in all functions where a name is expected rather than a sf dataframe object. This should have no effect on existing code which should “fuzzy match” dataset => datasetName.
  • Updated ebolamap.Rmd vignette to pass R CMD check.
  • Minor documentation improvements.
  • Removed unused dependency on tidyr.
  • Replaced non-ASCII characters to satisfy CRAN checks.
  • Consistent parameter validation in all get~() functions.
  • URL corrections for CRAN submission.
  • Vignette wordsmithing.
  • Test updates.
  • URL corrections after testing with win-builder.
  • Reordered parameters in installSpatialData() so that dataset comes first.
  • installSpatialData() attempts to install simplified versions of datasets: “_05”, “_02” and “_01”.
  • Replacement of lon and lat in getHUC() and getHUCName().
  • subsetHUC() now handles NA values in SFDF$allStateCodes.
  • Congressional districts dataset name now includes session number:
    USCensus116thCongress.

Version 0.7 includes more datasets that have all been through identical processing and harmonization steps. In general, this release represents a clean-and-update revision that brings all aspects of the package up to modern standards.

Improvements include:

  • Fewer package dependencies.
  • Minor updates to vignettes and articles.
  • Consistent replacement of lon and lat withlongitudeandlatitude` in all functions.
  • Updated convertWikipediaTimezeonTable().
  • Updated convertWorldTimezones() and package internal dataset SimpleTimezones.
  • Updated convertGADM() to support GADM version 3.6.
  • Updated convertEEZCountries() and SimpleCountriesEEZ dataset.
  • Updated SimpleCountries dataset
  • Added US_countyCodes dataset with stateCode, stateFIPS, countyName, countyFIPS.

New functions for converting between US county names/FIPS: * US_countyNameToFIPS() * US_countyFIPSToName()

  • Updated convertWorldEEZ.R.
  • Updated convertHMSSmoke.R.
  • Updated convertStateLegislativeDistricts.R.
  • Updated convertTMWorldBordersSimple.R.
  • Updated convertTMWorldBorders.R.
  • Updated convertSimpleCountries.R.
  • Updated convertGACC.R.
  • Updated convertNWSFireZones.R.
  • Updated convertMTBSBurnArea.R.
  • Updated convertNaturalEarthAdm1.R.
  • Removed non-working app/ directory and dependency on shiny.
  • Corrected Bosnia country code in convertWikipediaTimezoneTable.R.
  • Updated convertEPARegions.R.
  • Updated convertOSMTimeZones.R.
  • Updated convertTerrestrialEcoregions.R.
  • Updated convertWeatherZones.R.
  • Updated convertGACC.R to use 2020 data.
  • Removed outlying territories from US_stateCodes.
  • Updated convertUSCensusStates.R to use 2019 data.
  • Updated convertCARBAirBains.R to latest coding style.
  • Updated convertUSCensusCBSA.R to latest coding style.
  • Updated convertIndianLands.R to latest coding style.
  • Now using the cleangeo package to fix topology errors and geometry validity issues.

New functions for converting among US state names/codes/FIPS: * US_stateCodeToName() * US_stateCodeToFIPS() * US_stateFIPSToCode() * US_stateFIPSToName() * US_stateNameToCode() * US_stateNameToFIPS()

  • New “Developer Style Guide” article.
  • New “Basic GIS in R” article.
  • loadSpatialData() now recognizes both .RData and .rda files.
  • Improved documentation
  • New convert functions:
    • convertEPARegions()
    • convertMTBSBurnArea()
    • convertUSCensusUrbanAreas()
    • convertUSFSRangerDistricts()
  • New convertHILFDFederalLands() function.
  • Added tidyr package to Imports.
  • Updated docker image.
  • Modified test infrastructure to address CRAN issues.
  • Added useBuffering argument to getUSCounties().
  • Addressed bug in loadSpatialData() which errored out when a directory existed with the same name as the dataset trying to be loaded.
  • Updated summarizeByPolygon() to modern dplyr syntax.
  • Added %>% operator.
  • Code style refactoring.
  • made simplify() function example donotrun so as to avoid a CRAN testing failure on fedora only – Ugh.
  • changes associated with minor version bump
  • refactored shiny app from localShiny and added it to package in inst
  • added runExample() to run shiny examples
  • updated README.md
  • New convert function for public health districts
  • New convert function for GACCs
  • more testing
  • added CONUS and US_52 vectors of US state codes as package data
  • added US_stateCodes dataframe as package data
  • added convertStateLegislativeDistricts() function to download and convert US state level legislative districts on demand
  • now using countrycode package for all code/name conversions
  • ebolamap.Rmd converted to vignette, moved to vignettes/ and localNotebooks/ deleted
  • usages of cat() replaced with message(), warning(), or error()
  • corrected GADM URL in documentation for convertGADM()
  • fixed use of allStateCodes in WBD~ datasets
  • converted USIndianLands@data data from factor to character
  • updated docker/Dockerfile
  • added ebolaMap vignette
  • tweaks to satisfy CRAN
  • package now Depends on sp package so that sp plotting is used by default
  • package includes higher resolution SimpleCountries and SimpleTimezones datasets
  • internal standard now requires unique polygonID column for every dataset
  • organizePolygons() now uniformly uses polygonID for rownames and polygons@ID so you can say: plot(SimpleCountries['IT',])
  • fixed bug in processing of USCensusCounties dataset
  • changed codeToCode() to two functions: iso2ToIso3() and iso3ToIso2()
  • package now includes SimpleCountriesEEZ dataset which is used as the default dataset for getCountry(). SimpleCountriesEEZ includes a 200-mile offshore buffer for more efficient and accurate spatial searches
  • new datasets include: TerrestrialEcoregions, USCensus115thCongress, USCensusStates, USCensusIndianLands
  • new .tar.gz file available containing spatial datasets
  • new installSpatialData() installs all required datasets
  • loadSpatialData() no loads one or more datasets based on a pattern
  • removed initializeSpatialData()
  • convertGADM() updated to GADM version 2.8 (handles .rds files)
  • updated localVignettes/ebolaMap.Rmd
  • new docker/ directory for building docker images to run MazamaSpatialUtils
  • new app/ directory demonstrates dockerized web-service based on MazamaSpatialUtils
  • locations that do not intersect any polygon now return NA rather than generating warnings
  • various minor bug fixes.
  • convertHMSSmoke() now handles shapefiles with new Density information
  • Fixed bug/typo in findTimezones demo.
  • Fixed bugs/typos in convertWBDHUC() and convertHMSSmoke().
  • New convertHMSSmoke() function for smoke data from the NOAA Hazard Mapping Service.
  • Shapefiles with no projection information are assigned "+proj=longlat +ellps=GRS80 +datum=NAD83 +no_defs".
  • Added dependency on lubridate package.
  • getSpatialData() no longer fails on invalid/missing locations, now returns dataframe rows with all NA.
  • Updated included datasets to use "+proj=longlat +ellps=GRS80 +datum=NAD83 +no_defs".
  • Addition of buffered search so that locations can find nearby polygons.
  • Addition of convertWorldEEZ() function.
  • Updated default projection from "+proj=longlat" to "+proj=longlat +ellps=GRS80 +datum=NAD83 +no_defs" to support libproj >= 4.9.1
  • Removed unneeded test that failed with sp version 1.1-0.
  • User specification of SpatialDataDir is now required.
  • Minor documentation improvements.
  • Convert functions for GADM administrative boundaries and and USGS watershed datasets.
  • Addition of code-name, name-code and code-code conversion utilities.
  • Addition of organizePolygons() function.