rarcgisarcgis-server

ArcGis Rest API - How to get raster layer from MapServer?


I am trying to get a raster layer (5-metre Digital Elevation Model (DEM)) from the Australian government through the ArcGIS REST API

url: https://services.ga.gov.au/site_9/rest/services/DEM_LiDAR_5m/MapServer/

I can perform a query for the boundary and footprint layers with good results

boundary query:

"https://services.ga.gov.au/site_9/rest/services/DEM_LiDAR_5m/MapServer/1/query?where=&text=&objectIds=&time=&geometry=xmin:133.226100657682, ymin:-23.6165145646468, xmax:133.235899342318, ymax:-23.6074854353532&geometryType=esriGeometryEnvelope&inSR=4283&spatialRel=esriSpatialRelEnvelopeIntersects&relationParam=&outFields=&returnGeometry=true&maxAllowableOffset=&geometryPrecision=&outSR=&returnIdsOnly=false&returnCountOnly=false&orderByFields=&groupByFieldsForStatistics=&outStatistics=&returnZ=false&returnM=false&gdbVersion=&returnDistinctValues=false&f=json"

response (plotted in R):

R plot through jsonlite response

Footprint query:

"https://services.ga.gov.au/site_9/rest/services/DEM_LiDAR_5m/MapServer/2/query?where=&text=&objectIds=&time=&geometry=xmin:133.226100657682, ymin:-23.6165145646468, xmax:133.235899342318, ymax:-23.6074854353532&geometryType=esriGeometryEnvelope&inSR=4283&spatialRel=esriSpatialRelEnvelopeIntersects&relationParam=&outFields=&returnGeometry=true&maxAllowableOffset=&geometryPrecision=&outSR=&returnIdsOnly=false&returnCountOnly=false&orderByFields=&groupByFieldsForStatistics=&outStatistics=&returnZ=false&returnM=false&gdbVersion=&returnDistinctValues=false&f=json"

response:

jsonlite response in R

where I got the name of TIF files I am looking for, nevertheless all my queryes to the raster layer: https://services.ga.gov.au/site_9/rest/services/DEM_LiDAR_5m/MapServer/3 does not give me any result

I have tried the rcran package "arcpullr" as well, but no results

any help?

library(arcpullr)
library(sf)
library(jsonlite)

loc_lng <- 133.231
loc_lat <- -23.612
study_area <- 1000

bbox_area <- osmar::center_bbox(loc_lng, loc_lat, study_area, study_area)
loc_bbox_pol <- tmaptools::bb_poly(bbox_area)
loc_bbox_pol <- sf::st_as_sf(loc_bbox_pol)
sf::st_crs(loc_bbox_pol) = 4326
loc_bbox_pol <- sf::st_transform(loc_bbox_pol, 4283)

DEM_general <- arcpullr::get_layer_by_poly("https://services.ga.gov.au/site_9/rest/services/DEM_LiDAR_5m/MapServer/0/", loc_bbox_pol, sp_rel = "esriSpatialRelIndexIntersects")
DEM_Boundary <- arcpullr::get_layer_by_poly("https://services.ga.gov.au/site_9/rest/services/DEM_LiDAR_5m/MapServer/1/", loc_bbox_pol, sp_rel = "esriSpatialRelIndexIntersects")
DEM_Info <- arcpullr::get_layer_by_poly("https://services.ga.gov.au/site_9/rest/services/DEM_LiDAR_5m/MapServer/2/", loc_bbox_pol, sp_rel = "esriSpatialRelIndexIntersects")
arcpullr::get_service_type("https://services.ga.gov.au/site_9/rest/services/DEM_LiDAR_5m/MapServer/3/")

Solution

  • So most likely data provider has disabled the query operation on the 3rd layer of that map service. Also, no fields are enabled on the layer 3, so there is nothing to query or return through a query operation.

    So only export operation would work on that by providing a bbox (which you can use also by using the results of the footprint layer).

    https://services.ga.gov.au/site_9/rest/services/DEM_LiDAR_5m/MapServer/export?bbox=-5611089.372356728%2C-5642303.594604798%2C5611089.372356728%2C-3900762.342155805&bboxSR=%7B%22wkt%22%3A%22PROJCS%5B%5C%22WGS_1984_Web_Mercator_Auxiliary_Sphere%5C%22%2CGEOGCS%5B%5C%22GCS_WGS_1984%5C%22%2CDATUM%5B%5C%22D_WGS_1984%5C%22%2CSPHEROID%5B%5C%22WGS_1984%5C%22%2C6378137.0%2C298.257223563%5D%5D%2CPRIMEM%5B%5C%22Greenwich%5C%22%2C0.0%5D%2CUNIT%5B%5C%22Degree%5C%22%2C0.0174532925199433%5D%5D%2CPROJECTION%5B%5C%22Mercator_Auxiliary_Sphere%5C%22%5D%2CPARAMETER%5B%5C%22False_Easting%5C%22%2C0.0%5D%2CPARAMETER%5B%5C%22False_Northing%5C%22%2C0.0%5D%2CPARAMETER%5B%5C%22Central_Meridian%5C%22%2C149.430392074675%5D%2CPARAMETER%5B%5C%22Standard_Parallel_1%5C%22%2C0.0%5D%2CPARAMETER%5B%5C%22Auxiliary_Sphere_Type%5C%22%2C0.0%5D%2CUNIT%5B%5C%22Meter%5C%22%2C1.0%5D%5D%22%7D&imageSR=%7B%22wkt%22%3A%22PROJCS%5B%5C%22WGS_1984_Web_Mercator_Auxiliary_Sphere%5C%22%2CGEOGCS%5B%5C%22GCS_WGS_1984%5C%22%2CDATUM%5B%5C%22D_WGS_1984%5C%22%2CSPHEROID%5B%5C%22WGS_1984%5C%22%2C6378137.0%2C298.257223563%5D%5D%2CPRIMEM%5B%5C%22Greenwich%5C%22%2C0.0%5D%2CUNIT%5B%5C%22Degree%5C%22%2C0.0174532925199433%5D%5D%2CPROJECTION%5B%5C%22Mercator_Auxiliary_Sphere%5C%22%5D%2CPARAMETER%5B%5C%22False_Easting%5C%22%2C0.0%5D%2CPARAMETER%5B%5C%22False_Northing%5C%22%2C0.0%5D%2CPARAMETER%5B%5C%22Central_Meridian%5C%22%2C149.430392074675%5D%2CPARAMETER%5B%5C%22Standard_Parallel_1%5C%22%2C0.0%5D%2CPARAMETER%5B%5C%22Auxiliary_Sphere_Type%5C%22%2C0.0%5D%2CUNIT%5B%5C%22Meter%5C%22%2C1.0%5D%5D%22%7D&size=3441%2C534&dpi=144&format=png32&transparent=true&layers=show%3A3&f=html