Download a spatial file from an API and save it to a local folder, overwriting existing file if it exists and has changed. writeLayerIfChanged is used by TADA_UpdateTribalLayers in TADAGeospatialRefLayers.R.
Source:R/Utilities.R
writeLayerIfChanged.RdDownload a spatial file from an API and save it to a local folder, overwriting existing file if it exists and has changed. writeLayerIfChanged is used by TADA_UpdateTribalLayers in TADAGeospatialRefLayers.R.
Examples
if (FALSE) { # \dontrun{
# Get the Oklahoma Tribal Statistical Areas feature layer and write
# local file to inst/extdata/Tribal.gpkg/OKTribe
OKTribeUrl <- "https://geopub.epa.gov/arcgis/rest/services/EMEF/Tribal/MapServer/4/query"
writeLayerIfChanged(OKTribeUrl, "inst/extdata/Tribal.gpkg","OKTribe")
} # }