GetSpatialData
An R package 📦 making it easy to query, preview, download and preprocess multiple kinds of spatial data 🛰 via R. All beta.
Install / Use
/learn @16EAGLE/GetSpatialDataREADME
getSpatialData <a href="https://jakob.schwalb-willmann.de/getSpatialData"><img align="right" src="https://raw.githubusercontent.com/16EAGLE/AUX_data/master/data/gSD_hex.png" /></a>
<!-- badges: start --> <!-- badges: end -->Introduction
getSpatialData is an R package in an early development stage that ultimately aims to enable homogeneous and reproducible workflows to query, preview, analyze, select, order and download various kinds of spatial datasets from open sources.
The package enables generic access to multiple data distributors with a common syntax for 159 products.
Among others getSpatialData supports these products: Sentinel-1, Sentinel-2, Sentinel-3, Sentinel-5P, Landsat 8 OLI, Landsat ETM, Landsat TM, Landsat MSS, MODIS (Terra & Aqua) and SRTM DEMs. For this, getSpatialData facilitates access to multiple services implementing clients to public APIs of ESA Copernicus Open Access Hub, USGS EarthExplorer, USGS EROS ESPA, Amazon Web Services (AWS), NASA DAAC LAADS and NASA CMR search. A full list of all supported products can be found below.
getSpatialData offers to quickly overview the data catalogues for a custom place and time period.
For an efficient handling of available earth observation data, it specifically calculates the cloud coverage of records
in an area of interest based on light preview images. Furthermore, getSpatialData is able
to automatically select records based on cloud cover and temporal user requirements.
Installation
To install the current beta version, use devtools:
devtools::install_github("16EAGLE/getSpatialData")
Workflow
The getSpatialData workflow is designed to be as reproducible as possible and is made of six steps:
- querying products of interest (see
get_products()) for available records by an area of interest (AOI) and time (seeget_records()), - previewing geometries and previews of the obtained records (see
get_previews(),view_records()andview_previews()), - analysing records by deriving scene and AOI cloud distribution and coverage directly from preview imagery (see
calc_cloudcov()), - selecting records based on user-defined measures (see
select_unitemporal(),select_bitemporal()andselect_timeseries()), - ordering datasets that are not available for immediate download (on-demand) but need to be ordered or restored before download (see
check_availability()andorder_data()), and lastly - downloading the full datasets for those records that have been selected in the process, solely based on meta and preview-dervied data.
For all steps, getSpatialData supports local chaching to reduce bandwith usage and uneccasary downloads.
This approach is implemented by the following functions (sorted by the order in which they would be typically used):
Defining session settings
set_aoi(),view_aoi()andget_aoi()set, view and get a session-wide area of interest (AOI) that can be used by allgetSpatialDatafunctions.set_archive()andget_archive()set and get a session-wide archive directory that can be used by allgetSpatialDatafunctions.
Logging in
login_CopHub()logs you in at the ESA Copernicus Open Access Hub using your credentials (register once at https://scihub.copernicus.eu/).login_USGS()logs you in at the USGS EROS Registration System (ERS) using your credentials (register once at https://ers.cr.usgs.gov/register/).login_earthdata()logs you in at the NASA Earth Data User Registration System (URS) using your credentials (register once at https://urs.earthdata.nasa.gov/users/new)services()displays the status of all online services used bygetSpatialData.
Retrieving and visualizing records
get_products()obtains the names of all products available usinggetSpatialData. Currently,getSpatialDatasupports 159 products, including Sentinel, Landsat, MODIS and SRTM products.get_records()queries a service for available records using basic input search parameters such as product name, AOI and time range and returns ansf data.framecontaining meta data and the geometries of each record.view_records()andplot_records()display the footprint geometries of each record on a map.
Analysing previews
get_previews()downloads and georeferences preview images for visual inspection or automatic analysis and saves them to disk.view_previews()andplot_previews()load and display georeferenced previews acquired usingget_previews().get_cloudcov_supported()tells you for which products preview-based cloud coverages can be calculated usingcalc_cloudcov().calc_cloudcov()calculates the AOI cloud cover and optionally saves raster cloud masks, all based on preview images.
Selecting records
Automatic remote sensing records selection is possible both for optical and SAR products.
select_* functionalities also support fusion of multiple optical products.
The selection is based on aoi cloud cover of optical records and temporal characterstics.
For optical records select_* uses preview cloud masks from calc_cloudcov() to create timestamp-wise mosaics.
It aims at cloud-free mosaics while ensuring user-defined temporal and product constraints.
get_select_supported()tells you for which products automatic record selection is supported.select_unitemporal()selects remote sensing records uni-temporallyselect_bitemporal()selects remote sensing records bi-temporallyselect_timeseries()selects remote sensing records for a time seriesis.*(), such asis.sentinel(),is.landsat(),is.modis()and more to simplify filtering of records.
Checking, ordering and downloading records
check_availability()checks for each record whether it is available for direct download (can be downloaded instantly) or not (and thus must be ordered before download).order_data()oders datasets that are not available for immediate download (on-demand) but need to be ordered or restored before download.get_data()downloads the full datasets per records.
Writing and reading
get_records_drivers()provides the driver names that can be used inwrite_records().write_records()writes records, e.g. asGeoJSON, for later use.read_records()reads records that have been written throughwrite_records().read_previews()reads georeferences preview images downloaded usingget_previews().
Get started
The following example demonstrates a workflow for querying, previewing, analysing, selecting, ordering and downloading optical data from multiple sources at once (in this case Sentinel-2 L2A and Landsat 8 OLI Surface Reflectances).
library(getSpatialData)
data("aoi_data")
# Define an archive directory:
set_archive("/path/to/your/archive/directory/")
# Define an area of interest (AOI):
# Use the example AOI or draw an AOI by calling set_aoi():
set_aoi(aoi_data[[1]])
# View the AOI:
view_aoi()

# There are three services to login at:
login_CopHub(username = "yourusername")
#> Login successfull. ESA Copernicus credentials have been saved for the current session.
login_USGS(username = "yourusername")
#> Login successfull. USGS ERS credentials have been saved for the current session.
login_earthdata(username = "yourusername")
#> Login successfull. NASA URS EarthData credentials have been saved for the current session.
# Print the status of all services:
services()
#> ● ESA Copernicus Open Hub: 'available' 'Connection successfully established.'
#> ● ESA Copernicus S5P Hub: 'available' 'Connection successfully established.'
#> ● ESA Copernicus GNSS Hub: 'available' 'Connection successfully established.'
#> ● USGS-EROS ESPA: 'available' 'Connection successfully established.'
#> ● USGS EarthExplorer: 'available' 'Connection successfully established.'
#> ● AWS Landsat 8: 'available' 'Connection successfully established.'
#> ● NASA DAAC LAADS: 'available' 'Connection successfully established.'
# First, print all available products:
get_products()
#> [1] "Sentinel-1" "Sentinel-2" "Sentinel-3"
#> [4] "Sentinel-5P" "Sentinel-1_GNSS" "Sentinel-2_GNSS"
#> [7] "Sentinel-3_GNSS" "LANDSAT_ETM_C1" "LANDSAT_MSS_C1"
#> [10] "LANDSAT_TM_C1" "LANDSAT_8_C1" "MODIS_MCD43D28_V6"
#> [13] "MODIS_MYD21A1N_V6" "MODIS_MCD43A1_V6" "MODIS_MCD43A2_V6"
#> [16] "MODIS_MCD43A3_V6" "MODIS_MCD43A4_V6" "MODIS_MCD43C1_V6"
#> [19] "MODIS_MCD43C2_V6" "MODIS_MCD43C3_V6" "MODIS_MCD43C4_V6"
#> [22] "MODIS_MCD43D01_V6" "MODIS_MCD43D02_V6" "MODIS_MCD43D03_V6"
#> [25] "MODIS_MCD43D04_V6" "MODIS_MCD43D05_V6" "MODIS_MCD43D06_V6"
#> [28] "MODIS_MCD43D07_V6" "MODIS_MCD43D08_V6" "MODIS_MCD43D09_V6"
#> [31] "MODIS_MCD43D10_V6" "MODIS_MCD43D11_V6" "MODIS_MCD43D12_V6"
#> [34] "MODIS_MCD43D13_V6" "MODIS_MCD43D14_V6" "MODIS_MC
Related Skills
node-connect
336.9kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
83.0kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
336.9kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
commit-push-pr
83.0kCommit, push, and open a PR
