| Title: | Spatial Data Sources |
|---|---|
| Description: | Functions for descriptions of spatial data sources that can be read directly with or without download. Most sources are readable by 'GDAL' software. There are functions for imagery, elevation, and a variety of easily accessible data streams including image tile servers, links to online files, and geographic data services. |
| Authors: | Michael Sumner [aut, cre] |
| Maintainer: | Michael Sumner <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.0.1.9015 |
| Built: | 2026-06-02 10:27:32 UTC |
| Source: | https://github.com/hypertidy/sds |
https://data.bas.ac.uk/full-record.php?id=GB/NERC/BAS/PDC/01409
addrock()addrock()
CGAZ() returns the DSN, a shapefile of geo boundaries, CGAZ_sql() returns SQL suitable for use with GDAL, for the names or codes of countries.
CGAZ(old = FALSE) CGAZ_sql(codes)CGAZ(old = FALSE) CGAZ_sql(codes)
old |
logical, return the old slow zipped shapefile or the new Parquet copy |
codes |
a list of iso3 country codes, or country names (this is a bit sketchy) |
CGAZ_sql(c("Australia", "New Zealand")) CGAZ_sql(c("AUS", "NZL")) ## do something like gdal_raster_data(gebco(), target_res = 1, ## options = c("-crop_to_cutline", ## "-cutline", CGAZ(), ## "-csql", CGAZ_sql(c("Australia", "New Zealand")) ))CGAZ_sql(c("Australia", "New Zealand")) CGAZ_sql(c("AUS", "NZL")) ## do something like gdal_raster_data(gebco(), target_res = 1, ## options = c("-crop_to_cutline", ## "-cutline", CGAZ(), ## "-csql", CGAZ_sql(c("Australia", "New Zealand")) ))
Raster and imagery online
wms_arcgis_mapserver_ESRI.WorldImagery_tms() wms_bluemarble_s3_tms() wms_googlehybrid_tms() wms_virtualearth() wms_ESA_worldcover_2020_tms() wms_mapbox_satellite() wms_amazon_elevation() wms_mapbox_terrain() wms_openstreetmap_tms() wms_googleterrainstreets_tms() wms_virtualearth_street() wms_arcgis_mapserver_tms() nasadem() cop90() cop30() srtm15()wms_arcgis_mapserver_ESRI.WorldImagery_tms() wms_bluemarble_s3_tms() wms_googlehybrid_tms() wms_virtualearth() wms_ESA_worldcover_2020_tms() wms_mapbox_satellite() wms_amazon_elevation() wms_mapbox_terrain() wms_openstreetmap_tms() wms_googleterrainstreets_tms() wms_virtualearth_street() wms_arcgis_mapserver_tms() nasadem() cop90() cop30() srtm15()
ESACCI chlorophyll-a in monthly
esacci_chlor_a(time.resolution = "monthly")esacci_chlor_a(time.resolution = "monthly")
time.resolution |
monthly only for now |
data frame with date,source
dsn <- esacci_chlor_a()dsn <- esacci_chlor_a()
A data source name to the GEBCO elevation 'COG' GeoTIFF.
gebco(vsi = TRUE) gebco25(vsi = TRUE) gebco24(vsi = TRUE) gebco21(vsi = TRUE) gebco23_bedrock(vsi = TRUE) gebco23(vsi = TRUE) gebco22(vsi = TRUE) gebco19(vsi = TRUE)gebco(vsi = TRUE) gebco25(vsi = TRUE) gebco24(vsi = TRUE) gebco21(vsi = TRUE) gebco23_bedrock(vsi = TRUE) gebco23(vsi = TRUE) gebco22(vsi = TRUE) gebco19(vsi = TRUE)
vsi |
include the 'vsicurl' prefix ( |
GEBCO 2023 and 2022 is created and hosted by Philippe Massicotte.
GEBCO 2019 and 2021 created and hosted by the Australian Antarctic Division.
See note about which forms of the bedrock vs ice surface are available. Generally we use the ice surface form, because that is what encountered while navigating the surface of the Earth. But, the bedrock is of course also of interest. "If the data sets are used in a presentation or publication then we ask that you acknowledge the source. This should be of the form (see references)."
character string, URL to online GeoTIFF
please note that gebco21(), gebco19(), gebco24() and gebco25() return the ice surface form, while gebco22() returns the bedrock form. With gebco23() and gebco23_bedrock() these are now both avaiable, again thanks to Philippe Massicotte.
https://www.gebco.net/data-products/gridded-bathymetry-data 'GEBCO Compilation Group (2025) GEBCO 2025 Grid (doi:10.5285/37c52e96-24ea-67ce-e063-7086abc05f29)'
gebco()gebco()
GHRSST files, GeoTIFFs on source.coop
ghrsst(vsi = TRUE)ghrsst(vsi = TRUE)
dataframe of source,date
files <- ghrsst() tail(files$source)files <- ghrsst() tail(files$source)
A data source name to the IBCSO elevation 'COG' GeoTIFF.
ibcso(vsi = TRUE, chart = FALSE)ibcso(vsi = TRUE, chart = FALSE)
vsi |
include the 'vsicurl' prefix ( |
chart |
the image or the data? set to TRUE for image (it's a PDF) |
Currently at v2.
character string, URL to online raster
ibcso()ibcso()
Title
list_address(address)list_address(address)
address |
string URI for List service
x <- list_address(c(2862, "LYELL", "HAYES")) #vals <- jsonlite::fromJSON(readr::read_file ( x), simplifyVector = F)$features[[1]]$attributes #plot(v <- vect(list_parcel(vals$PID))) #Sys.setenv("GDAL_DISABLE_READDIR_ON_OPEN"="TRUE") #dem <- rast("/vsicurl/https://s3.us-west-2.amazonaws.com/us-west-2.opendata.source.coop/alexgleith/tasmania-dem-2m/Tasmania_Statewide_2m_DEM_14-08-2021.tif") #plotRGB(project(rast(ortho), rast(v, res = .1), by_util = TRUE)) #plot(v, add = T)x <- list_address(c(2862, "LYELL", "HAYES")) #vals <- jsonlite::fromJSON(readr::read_file ( x), simplifyVector = F)$features[[1]]$attributes #plot(v <- vect(list_parcel(vals$PID))) #Sys.setenv("GDAL_DISABLE_READDIR_ON_OPEN"="TRUE") #dem <- rast("/vsicurl/https://s3.us-west-2.amazonaws.com/us-west-2.opendata.source.coop/alexgleith/tasmania-dem-2m/Tasmania_Statewide_2m_DEM_14-08-2021.tif") #plotRGB(project(rast(ortho), rast(v, res = .1), by_util = TRUE)) #plot(v, add = T)
Cadastral parcel source
list_parcel_shp()list_parcel_shp()
string URI for List shapefile
list_parcel_shp() ## read with terra::vect( ) or new(gdalraster::GDALVector, )list_parcel_shp() ## read with terra::vect( ) or new(gdalraster::GDALVector, )
Rendered calc VRT that unpacks planet.pmtiles from Mapterhorn, a large collection of regional elevation sources encoded in Terrarium Terrain RGB '(R*256 + G + B/256) - 32768'
mapterhorn_elevation(...)mapterhorn_elevation(...)
... |
unused |
VRT text string, useable by GDAL >= 3.14 with muparser support
writeLines(mapterhorn_elevation())writeLines(mapterhorn_elevation())
Function mpc() will return a full data source name for a Spatio-Temporal Asset Catalog ('STAC').
mpc( collection = "sentinel-2-l2a", bbox = "146.5,-43.2,147.5,-42.2", datetime = Sys.Date() + c(-5, 1), asset = "", stacit = TRUE )mpc( collection = "sentinel-2-l2a", bbox = "146.5,-43.2,147.5,-42.2", datetime = Sys.Date() + c(-5, 1), asset = "", stacit = TRUE )
collection |
name of the collection e.g. "sentinel-2-l2a", "naip", or ""landsat-c2-l2" |
bbox |
a string in the form 'xmin,ymin,xmax,ymax' where x,y are longitude and latitude values (OR a numeric extent xmin,xmax,ymin,ymax) |
datetime |
a datetime of 1 or 2 values to give a range in time, if only one is given it is treated as an open interval to the present |
asset |
name of the asset of interest, e.g. for "sentinel-2-l2a" there is "visual", "AOT", "B04" etc. |
stacit |
logical, treat this as a 'GDAL STACIT' source, or just a generic MPC query, 'TRUE' by default |
Each argument has a default, use them to set the collection, datetime range, bounding box, and asset.
If no asset is specfied the description is a complex source composed of multiple subdatasets ('GDAL' terminology). In a 'STAC' context "asset" and "subdataset" are synonomous for 'GDAL'.
a string, a data source name for 'GDAL'
mpc() ## we can be more general than GDAL, and say do a query to get Parquet for MS Buildings mpc(collection = "ms-buildings", stacit = FALSE, bbox = "140,-45,145,-30", datetime = as.Date("2000-01-01")) ## read that url with jsonlite and investigate $features$assets$data$href ## but it's all abfs:// azure special linksmpc() ## we can be more general than GDAL, and say do a query to get Parquet for MS Buildings mpc(collection = "ms-buildings", stacit = FALSE, bbox = "140,-45,145,-30", datetime = as.Date("2000-01-01")) ## read that url with jsonlite and investigate $features$assets$data$href ## but it's all abfs:// azure special links
This is used a lot of noisy fanfare about why everyone must move to Zarr in the cloud. It's really big, daily netcdf blended/observation/model data on a 36000x18000 grid, a regular grid in -180, 180, -90, 90.
mursst_zarr(band = 0) mursst_time(time = NULL)mursst_zarr(band = 0) mursst_time(time = NULL)
band |
a band number (defaults to 0, which is 2002-06-01) |
time |
a time value to pick, see Details |
This zarr and every other one I've found is unuseably out of date. It seems like this source doesn't go past "2020-01-21" or band 6443, don't know why that is.
a string, a dsn for Zarr MURSST
mursst() mursst_time("2019-10-08")mursst() mursst_time("2019-10-08")
Data is colour-palette GeoTIFF in polar stereographic raster format.
nsidc_seaice( date, hemisphere = c("south", "north"), temporal = c("daily", "monthly"), varname = c("concentration", "extent"), vsi = TRUE )nsidc_seaice( date, hemisphere = c("south", "north"), temporal = c("daily", "monthly"), varname = c("concentration", "extent"), vsi = TRUE )
date |
date in POSIXct or Date format, see Details |
hemisphere |
hemisphere of data source, north or south |
temporal |
temporal resolution of data source, daily or monthly |
varname |
variable name to obtain, concentration or extent (note this is a colour image) |
vsi |
prepend DSN with "/vsicurl/" or not |
The availability of the date is not checked currently, the minimum date is 1978-10-26. Please note that these data were only every two days from date, until a later time (FIXME get these details).
character string, GDAL readable DSN to a colour palette GeoTIFF (see args 'vsi' and others for options)
nsidc_seaice("2023-06-27") #readBin(con <- url(nsidc_seaice("2023-06-27", vsi = FALSE), open = "rb"), "raw"); close(con)nsidc_seaice("2023-06-27") #readBin(con <- url(nsidc_seaice("2023-06-27", vsi = FALSE), open = "rb"), "raw"); close(con)
This is a single description string for all of the 2m REMA. The VRT is crafted with efficient overviews so is much more performant with the warper API than other existing descriptions.
rema() rema_v2()rema() rema_v2()
See rema-ovr for examples.
character string, GDAL-readable raster data source name
The first subdataset 'cdr_seaice_conc' is the one you want, but also included are "cdr_seaice_conc_interp_spatial_flag", "cdr_seaice_conc_interp_temporal_flag", "cdr_seaice_conc_qa_flag", "cdr_seaice_conc_stdev", "raw_bt_seaice_conc", "raw_nt_seaice_conc" and "surface_type_mask"
seaice_cdr(date, hemisphere = c("south", "north"), vsi = TRUE)seaice_cdr(date, hemisphere = c("south", "north"), vsi = TRUE)
date |
date or or string YYYY-mm-dd |
hemisphere |
north or south |
vsi |
in GDAL url form |
I've had mixed success setting subdataset and having these return with the correct orientation.
string with path to CDR sea ice netcdf file
seaice_cdr()seaice_cdr()
To use this you must have your own "INSTANCE_ID", set this in env var "SENTINELHUB_INSTANCE_ID".
sentinel2_wms( layer = c("TRUE-COLOR-S2L2A", "NDVI", "FALSE-COLOR", "FALSE-COLOR-URBAN", "AGRICULTURE", "BATHYMETRIC", "GEOLOGY", "MOISTURE-INDEX", "SWIR", "NATURAL-COLOR"), datetime = NA )sentinel2_wms( layer = c("TRUE-COLOR-S2L2A", "NDVI", "FALSE-COLOR", "FALSE-COLOR-URBAN", "AGRICULTURE", "BATHYMETRIC", "GEOLOGY", "MOISTURE-INDEX", "SWIR", "NATURAL-COLOR"), datetime = NA )
layer |
see layer options in the argument, default is "TRUE-COLOR-S2L2A" |
datetime |
a valid datetime or NA for "latest" |
a string to a WMS
sentinel2_wms()sentinel2_wms()
Generate STAC API search URLs from an extent and date specification. Provides a simple interface for constructing valid STAC queries without manually assembling URL parameters.
stacit( extent, date = "", collections = "sentinel-2-c1-l2a", provider = c("https://earth-search.aws.element84.com/v1/search", "https://planetarycomputer.microsoft.com/api/stac/v1/search"), gdal_stacit = FALSE, limit = 300 )stacit( extent, date = "", collections = "sentinel-2-c1-l2a", provider = c("https://earth-search.aws.element84.com/v1/search", "https://planetarycomputer.microsoft.com/api/stac/v1/search"), gdal_stacit = FALSE, limit = 300 )
extent |
numeric vector (xmin, xmax, ymin, ymax) in longlat, or character MGRS 100km grid code |
date |
character, Date, or POSIXt specifying the temporal query.
Length 1 for an implied interval or length 2 for an explicit range.
Default |
collections |
character; STAC collection identifier(s) to search.
Default is |
provider |
character; base URL of the STAC API search endpoint. Default uses Element 84's Earth Search. Also supports Microsoft Planetary Computer. |
gdal_stacit |
logical; if |
limit |
integer; maximum number of items to return per query. Default 300. |
Character vector of STAC search URL(s). Returns multiple URLs when the extent crosses the anti-meridian.
The extent can be specified as either:
A numeric vector of length 4 giving xmin, xmax, ymin, ymax in longitude/latitude (EPSG:4326)
A character string giving a 100km MGRS grid square code (e.g. "43DFD")
Extents that cross the anti-meridian (i.e. where xmin < -180 or xmax > 180) are automatically split into two queries, one for each side of the ±180° boundary. This handles the case where a projected extent (e.g. UTM) spans the anti-meridian but STAC APIs truncate bounding boxes at -180/180.
The date parameter accepts flexible input formats that are expanded to ISO 8601 datetime intervals:
Year only: "2024" becomes 2024-01-01T00:00:00Z/2024-12-31T23:59:59Z
Year-month: "2024-06" expands to the full month interval
Full date: "2024-06-15" expands to that single day
Date range: c("2024-01-01", "2024-01-31") for explicit start/end
Date or POSIXt objects are also accepted
STAC API specification: https://github.com/radiantearth/stac-api-spec
GDAL STACIT driver: https://gdal.org/en/stable/drivers/raster/stacit.html
mpc() for Microsoft Planetary Computer catalog access;
sentinel2_wms() for Sentinel-2 WMS layer construction
# Simple bounding box query for today stacit(c(140, 145, -43, -40)) # MGRS grid square for a specific month stacit("43DFD", date = "2025-01") # Date range query stacit(c(140, 145, -43, -40), date = c("2024-06-01", "2024-06-30")) # Anti-meridian crossing returns two queries stacit(c(179, 181, -16, -15), date = "2024-03") # Use Planetary Computer instead of Earth Search stacit(c(140, 145, -43, -40), provider = "https://planetarycomputer.microsoft.com/api/stac/v1/search") # Query Landsat collection stacit(c(140, 145, -43, -40), collections = "landsat-c2-l2", date = "2024")# Simple bounding box query for today stacit(c(140, 145, -43, -40)) # MGRS grid square for a specific month stacit("43DFD", date = "2025-01") # Date range query stacit(c(140, 145, -43, -40), date = c("2024-06-01", "2024-06-30")) # Anti-meridian crossing returns two queries stacit(c(179, 181, -16, -15), date = "2024-03") # Use Planetary Computer instead of Earth Search stacit(c(140, 145, -43, -40), provider = "https://planetarycomputer.microsoft.com/api/stac/v1/search") # Query Landsat collection stacit(c(140, 145, -43, -40), collections = "landsat-c2-l2", date = "2024")
by MRT 2021
tas_dem(vsicurl = TRUE)tas_dem(vsicurl = TRUE)
vsicurl |
prefix with vsicurl or not |
data source name for Tasmania 2m DEM
tas_dem()tas_dem()
USGS seamless DEM
usgs_seamless(vsicurl = TRUE)usgs_seamless(vsicurl = TRUE)
vsicurl |
if TRUE prefix /vsicurl |
usgs_seamless()usgs_seamless()