Added a new set of country code conversion functions whose names match those for state and county conversions:
countryCodeToName()
countryCodeToFIPS()
countryFIPSToName()
countryCodeToCode()
countryNameToCode()
countryNameToFIPS()
These are now preferred over the older codeToCountry()
and countryToCode()
functions which, while deprecated, are
still supported for backwards compatibility.
getCountryCode()
and getTimezone()
without
invoking library MazamaSpatialUtils
.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
).
getSpatialData()
by simply choosing the first
polygon returned.convertWBDHUC()
and pre-generated spatial data
files: WBDHU2
, WBDHU4
, WBDHU6
,
WBDHU8
and WBDHU10
.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
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:
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
.ebolamap.Rmd
vignette to pass R CMD check.get~()
functions.installSpatialData()
so that
dataset
comes first.installSpatialData()
attempts to install simplified
versions of datasets: “_05”, “_02” and “_01”.lon
and lat
in
getHUC()
and getHUCName()
.subsetHUC()
now handles NA
values in
SFDF$allStateCodes
.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:
lon
and
lat with
longitudeand
latitude` in all
functions.convertWikipediaTimezeonTable()
.convertWorldTimezones()
and package internal
dataset SimpleTimezones
.convertGADM()
to support GADM version 3.6.convertEEZCountries()
and
SimpleCountriesEEZ
dataset.SimpleCountries
datasetUS_countyCodes
dataset with
stateCode
, stateFIPS
, countyName
,
countyFIPS
.New functions for converting between US county names/FIPS: *
US_countyNameToFIPS()
*
US_countyFIPSToName()
loadSpatialData()
that was returning
dataset names with ".rda"
.convertWorldEEZ.R
.convertHMSSmoke.R
.convertStateLegislativeDistricts.R
.convertTMWorldBordersSimple.R
.convertTMWorldBorders.R
.convertSimpleCountries.R
.convertGACC.R
.convertNWSFireZones.R
.convertMTBSBurnArea.R
.convertNaturalEarthAdm1.R
.app/
directory and dependency on
shiny.convertWikipediaTimezoneTable.R
.convertEPARegions.R
.convertOSMTimeZones.R
.convertTerrestrialEcoregions.R
.convertWeatherZones.R
.convertGACC.R
to use 2020 data.US_stateCodes
.convertUSCensusStates.R
to use 2019 data.convertCARBAirBains.R
to latest coding
style.convertUSCensusCBSA.R
to latest coding
style.convertIndianLands.R
to latest coding
style.New functions for converting among US state names/codes/FIPS: *
US_stateCodeToName()
* US_stateCodeToFIPS()
*
US_stateFIPSToCode()
* US_stateFIPSToName()
*
US_stateNameToCode()
*
US_stateNameToFIPS()
US_stateCodes
dataset to include only
stateName
, stateCode
and
stateFIPS
columns. It is now more complete with codes for
all states and territories.convertLayer()
now properly passes encoding to
rgdal::readOGR()
.convertUSCensusCounties()
to use 2019
data.loadSpatialData()
now recognizes both
.RData
and .rda
files.convertEPARegions()
convertMTBSBurnArea()
convertUSCensusUrbanAreas()
convertUSFSRangerDistricts()
convertHILFDFederalLands()
function.useBuffering
argument to
getUSCounties()
.loadSpatialData()
which errored out
when a directory existed with the same name as the dataset trying to be
loaded.summarizeByPolygon()
to modern dplyr
syntax.%>%
operator.simplify()
function example donotrun
so as to avoid a CRAN testing failure on fedora only – Ugh.runExample()
to run shiny examplesREADME.md
getHUC()
dissolve()
wrapper for
rmapshaper::ms_dissolve()
simplify()
wrapper for
rmapshaper::ms_simplify()
CONUS
and US_52
vectors of US state
codes as package dataUS_stateCodes
dataframe as package dataconvertStateLegislativeDistricts()
function to
download and convert US state level legislative districts on demandebolamap.Rmd
converted to vignette, moved to
vignettes/
and localNotebooks/
deletedcat()
replaced with message()
,
warning()
, or error()
convertGADM()
convertUSCensusCBSA()
to convert
Metropolitan-/Micropolitan Statistical Areasverbose
argument from
getStateCode()
function signatureallStateCodes
in WBD~
datasetsUSIndianLands@data
data from
factor
to character
docker/Dockerfile
ebolaMap
vignetteDepends
on sp package so
that sp plotting is used by defaultSimpleCountries
and
SimpleTimezones
datasetspolygonID
column
for every datasetorganizePolygons()
now uniformly uses
polygonID
for rownames and polygons@ID
so you
can say: plot(SimpleCountries['IT',])
USCensusCounties
datasetcodeToCode()
to two functions:
iso2ToIso3()
and iso3ToIso2()
getCountry()
.
SimpleCountriesEEZ
includes a 200-mile offshore buffer for
more efficient and accurate spatial searchesTerrestrialEcoregions
,
USCensus115thCongress
, USCensusStates
,
USCensusIndianLands
installSpatialData()
installs all required
datasetsloadSpatialData()
no loads one or more datasets based
on a patterninitializeSpatialData()
convertGADM()
updated to GADM version 2.8 (handles .rds
files)localVignettes/ebolaMap.Rmd
NA
rather than generating warningsconvertHMSSmoke()
now handles shapefiles with new
Density
informationfindTimezones
demo.convertWBDHUC()
and
convertHMSSmoke()
.convertHMSSmoke()
function for smoke data from the
NOAA Hazard
Mapping Service."+proj=longlat +ellps=GRS80 +datum=NAD83 +no_defs"
.encoding
argument to
converLayer()
.convertUSCensusCounties()
to use
encoding='latin1'
.useBuffering
argument to getState()
,
getCountry()
and getTimezone()
.getSpatialData()
no longer fails on invalid/missing
locations, now returns dataframe rows with all NA."+proj=longlat +ellps=GRS80 +datum=NAD83 +no_defs"
.convertWorldEEZ()
function."+proj=longlat"
to
"+proj=longlat +ellps=GRS80 +datum=NAD83 +no_defs"
to
support libproj >= 4.9.1SpatialDataDir
is now
required.organizePolygons()
function.