MazamaSpatialUtils: Mazama Science spatial data and utility functions.



This package contains code to convert various spatial datasets into .RData files with uniformly named identifiers including:

  • countryCode – ISO 3166-1 alpha-2

  • countryName – Country name

  • stateCode – ISO 3166-2 alpha-2

  • timezone – Olson timezone

  • longitude – degrees East

  • latitude – degrees North

  • area – m^2

The parameters listed above will be found in the @data slot of each spatial dataset whose source data has an equivalent field. The only field guaranteed to exist in every dataset is countryCode.

The following additional standards are applied during the data conversion process:

  • all spatial data are converted to a purely geographic projection (CRS("+proj=longlat +ellps=GRS80 +datum=NAD83 +no_defs")

  • no duplicated rows in the dataframe (conversion to multi-polygons)

  • lowerCamelCase, human readable names replace original parameter names

  • redundant, software-internal or otherwise unuseful data columns may be dropped

  • parameters may be added to the @data dataframe

  • latitude and longitude of polygon centroids may be added

Utility functions allow users to determine the country, state, county and timezones associated with a set of locations, e.g. environmental monitoring sites.

The uniformity of identifiers in the spatial datasets also makes it easy to generate maps with data from any dataset that uses standard ISO codes for countries or states.


version 0.4.3 – patch

  • Addition of convertHMSSmoke() function.

  • Shapefiles with no projection information are assigned "+proj=longlat +ellps=GRS80 +datum=NAD83 +no_defs".

  • Added dependency on lubridate package.

version 0.4.2 – patch

  • Added encoding argument to converLayer().

  • Modified convertUSCensusCounties() to use encoding='latin1'.

version 0.4.1 – patch

  • Added useBuffering to get-Sate,CountryTimezone functions.

version 0.3.2 – patch

  • getSpatialData() no longer fails on invliad/missing locations, now returns dataframe rows with all NA.

#' version 0.3.1 – addition of buffered search and WorldEEZ polygons

  • 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.

version 0.2.4 – patch

  • Updated default projection from "+proj=longlat" to "+proj=longlat +ellps=GRS80 +datum=NAD83 +no_defs" to support libproj >= 4.9.1

version 0.2.3 – patch

  • Removed unneeded test that fails with sp version 1.1-0.

version 0.2.2 – minor tweaks to 0.2.1

  • User specification of SpatialDataDir is now required.

  • Minor documentation improvements.

version 0.2.1 – addition of GADM and USGS HUC8

  • Converts for GADM administrative boundaries and and USGS watershed datasets.

  • Addition of code-name, name-code and code-code conversion utilities.

  • Addition of organizePolygons() function.

version 0.1 – initial release

Search within the MazamaSpatialUtils package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? or email at

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.