initializeMazamaSpatialUtils: Initialize MazamaSpatialUtils package

View source: R/initializeMazamaSpatialUtils.R

initializeMazamaSpatialUtilsR Documentation

Initialize MazamaSpatialUtils package

Description

Convenience function that wraps:

  MazamaSpatialUtils::setSpatialDataDir("~/Data/Spatial")
  MazamaSpatialUtils::loadSpatialData("EEZCountries.rda")
.  MazamaSpatialUtils::loadSpatialData("OSMTimezones.rda")
  MazamaSpatialUtils::loadSpatialData("NaturalEarthAdm1.rda")
  MazamaSpatialUtils::loadSpatialData("USCensusCounties.rda")

If spatial data has not yet been installed, an error is returned with an extended message detailing how to install the appropriate data.

Usage

initializeMazamaSpatialUtils(spatialDataDir = "~/Data/Spatial")

Arguments

spatialDataDir

Directory where MazamaSpatialUtils datasets are found.

Examples


library(MazamaLocationUtils)

# Fail gracefully if any resources are not available
try({

  # Set up directory for spatial data
  spatialDataDir <- tempdir() # typically "~/Data/Spatial"
  MazamaSpatialUtils::setSpatialDataDir(spatialDataDir)

  exists("NaturalEarthAdm1")
  initializeMazamaSpatialUtils(spatialDataDir)
  exists("NaturalEarthAdm1")
  class(NaturalEarthAdm1)
  
}, silent = FALSE)


MazamaLocationUtils documentation built on Sept. 11, 2024, 9:08 p.m.