Learn R Programming

getSpatialData (version 0.0.4)

gSD_settings: Session-wide settings and checks

Description

Functions that define session-wide archive and AOI settings that are used by all getSpatialData functions and check for the availability of used online services.

Usage

set_archive(dir_archive, create = T)

set_aoi(aoi)

view_aoi(color = "green")

get_aoi(type = "sf")

services_avail(value = F, verbose = T)

Arguments

dir_archive

character, directory to the getSpatialData archive folder.

create

logical, whether to create directory, if not existing or not.

aoi

nothing, if an interactve mapedit viewer should open letting you draw an AOI polygon. Otherwise, sfc_POLYGON or SpatialPolygons or matrix, representing a single multi-point (at least three points) polygon of your area-of-interest (AOI). If it is a matrix, it has to have two columns (longitude and latitude) and at least three rows (each row representing one corner coordinate). If its projection is not +proj=longlat +datum=WGS84 +no_defs, it is reprojected to the latter.

color

chracter, polygon filling color.

type

character, AOI object type, either "matrix", "sf" or "sp".

value

logical, whether to return a data frame containing service status or not. Default is FALSE.

verbose

logical, whether to display details on the function's progress or output on the console.

Value

None.

Details

set_archive defines the session directory on your machine (or an external device) where getSpatialData should build up its donwload data archive. Since getSpatialData handles big amounts of data, it is recommended to once define a location where enough free storage is available and then afterwards to not change the archive location. You need to define the archives location for each session after loading getSpatialData. It will then be remembered for the duration of the session. Apart from the archive location, you can manually define a download path when calling the *_data functions. If you do not define a path there, getSpatialData will direct the download to the defined archive. The archive is structred by sensors.

set_aoi defines a session AOI that is used for querying data within the running session (if no other AOI is provided with a query function call). If called without argument, an interactive mapedit viewer is opened letting you draw an AOI polygon. Otherwise, the function supports sf, sp or matrix objects as aoi input (see argument aoi).

view_aoi displays the defined session AOI on an interactive mapview/leaflet map.

get_aoi returns the defined session AOI.

services_avail displays the status of all online services used by getSpatialData. Services that are operating as usual are labeled "available". Returns a data.frame containing the service status, if argument value is set to TRUE.

See Also

getSentinel_query getLandsat_query

Examples

Run this code
# NOT RUN {
## set archive directory
dir.arc <- tempdir()
set_archive(dir.arc)

## set aoi (example aoi)
data("aoi_data")
set_aoi(aoi_data[[1]])

# }
# NOT RUN {
## draw aoi interactively
set_aoi() # just call without an argument

## view aoi
view_aoi()

## return aoi
aoi <- get_aoi(type = "sf")
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab