Download a map image from the ArcGIS REST API

get_arcgis_map_image(bbox, map_type = "World_Street_Map", file = NULL,
  width = NULL, height = NULL, sr_bbox = 4326, type = "MapServer")

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

type

MapServer will get a map, else elevation data gets downloaded

Value

file path for the downloaded .png map image

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 API docs: https://developers.arcgis.com/rest/services-reference/export-web-map-task.htm

Examples

bbox <- list( p1 = list(long = -122.522, lat = 37.707), p2 = list(long = -122.354, lat = 37.84) ) overlay_file <- get_arcgis_map_image(bbox)
#> { #> "results": [ #> { #> "paramName": "Output_File", #> "dataType": "GPDataFile", #> "value": { #> "url": "https://utility.arcgisonline.com/arcgis/rest/directories/arcgisoutput/Utilities/PrintingTools_GPServer/x_____xsFIBB1lAJwNn1rPymDWyng..x_____x_ags_8d61e198-0131-11ea-9429-22000b5593e4.png" #> } #> } #> ], #> "messages": [] #> }
#> image saved to file: /tmp/RtmpeVRaIx/overlay_img477b4d5d4470.png