get_arcgis_map_image: Download a map image from the ArcGIS REST API

Description Usage Arguments Details Value Examples

View source: R/get_map_data.R

Description

Download a map image from the ArcGIS REST API

Usage

1
2
3
4
5
6
7
8
get_arcgis_map_image(
  bbox,
  map_type = "World_Street_Map",
  file = NULL,
  width = 400,
  height = 400,
  sr_bbox = 4326
)

Arguments

bbox

bounding box coordinates (list of 2 points with long/lat values)

map_type

map type to download - options are World_Street_Map, World_Imagery, World_Topo_Map

file

file path to save to. Default is NULL, which will create a temp file.

width

image width (pixels)

height

image height (pixels)

sr_bbox

Spatial Reference code for bounding box

Details

This function uses the ArcGIS REST API, specifically the "Execute Web Map Task" task. You can find links below to a web UI for this rest endpoint and API documentation.

Web UI: https://utility.arcgisonline.com/arcgis/rest/services/Utilities/PrintingTools/GPServer/Export%20Web%20Map%20Task/execute API docs: https://developers.arcgis.com/rest/services-reference/export-web-map-task.htm

Value

file path for the downloaded .png map image

Examples

1
2
3
4
5
6
7
bbox <- list(
  p1 = list(long = -122.522, lat = 37.707),
  p2 = list(long = -122.354, lat = 37.84)
)
image_size <- define_image_size(bbox, 600)
overlay_file <- get_arcgis_map_image(bbox, width = image_size$width,
                                     height = image_size$height)

nmcdev/nmcMetIO documentation built on Jan. 30, 2022, 5:09 a.m.