1

I'm having trouble getting REST queries to work for any ESRI Map Service raster layers. Right now I've just been working with the query generator as part of the ESRI Service Directory. Here's are two Map Server examples:

https://apps.fs.usda.gov/arcx/rest/services/RDW_Wildfire/MTBS_CONUS/MapServer/5/query https://basemap.nationalmap.gov/arcgis/rest/services/USGSImageryTopo/MapServer/0/query

No matter what my query looks like I get "Invalid or missing input parameters." If this were a vector Map Service I'd put 1=1 in the WHERE clause and the service would return all the features contained in the layer. For raster layers in a Map Service I've tried every combination of inputs I can think of and always get the same "Invalid or missing input parameters.". If I specify JSON as the output format it shows up with error code 400 but I can't find anything on this either.

Edit

To be more specific I'm trying to figure out what is wrong with the REST query I'm trying to use, I know there are numerous other ways to access the information I'm looking for but to integrate this information with the rest of my workflow the data needs to come via an API call. I've tried removing fields and adding text or specifying a geometry, requesting only a count or IDS and I can't get anything to work. Here's an example of what one of my current queries looks like:

https://apps.fs.usda.gov/arcx/rest/services/RDW_Wildfire/MTBS_CONUS/MapServer/5/query?where=1%3D1&text=&objectIds=&time=&geometry=&geometryType=esriGeometryEnvelope&inSR=&spatialRel=esriSpatialRelIntersects&relationParam=&outFields=&returnGeometry=true&returnTrueCurves=false&maxAllowableOffset=&geometryPrecision=&outSR=&having=&returnIdsOnly=false&returnCountOnly=false&orderByFields=&groupByFieldsForStatistics=&outStatistics=&returnZ=false&returnM=false&gdbVersion=&historicMoment=&returnDistinctValues=false&resultOffset=&resultRecordCount=&queryByDistance=&returnExtentOnly=false&datumTransformation=&parameterValues=&rangeValues=&quantizationParameters=&featureEncoding=esriDefault&f=json

5
  • @cm1 That runs but it just returns the layers with the extent and function support not any of the actual data. Sep 11, 2020 at 21:01
  • 2
    Most probably these are mosaic datasets published as map service and Query is one of the map service capabilities. I think what you are trying to do can be done by Identify, gis.stackexchange.com/questions/83168/…
    – fatih_dur
    Sep 15, 2020 at 23:44
  • @fatih_dur I can't seem to get more than one point per layer on each identify request. Am I missing something or is it only possible to get a single value with identify? Sep 16, 2020 at 18:18
  • Let me add to my previous comment I can't seem to get multiple points using a geometry envelope. Sep 16, 2020 at 18:27

2 Answers 2

2

I think Query is more for making feature layer and table access. This being raster data I think there is a bit of mismatch. In the feature description it days it can support standardized queries but advanced queries are false etc.

You may want to try export https://apps.fs.usda.gov/arcx/rest/services/RDW_Wildfire/MTBS_CONUS/MapServer/export

biggest thing for export is the bounding box must be specified.

When I opened it in the JSapi from the service description the display of the data made a call to this url.

https://apps.fs.usda.gov/arcx/rest/services/RDW_Wildfire/MTBS_CONUS/MapServer/export?bbox=-14538132.889387406%2C2714574.244770844%2C-6996763.034785762%2C6670832.147551393&bboxSR=102100&imageSR=102100&size=1910%2C1002&dpi=96&format=png32&transparent=true&layers=show%3A0%2C1%2C2%2C3%2C4%2C5%2C6%2C7%2C8%2C9%2C10%2C11%2C12%2C13%2C14%2C15%2C16%2C17%2C18%2C19%2C20%2C21%2C22%2C23%2C24%2C25%2C26%2C27%2C28%2C29%2C30%2C31%2C32%2C33&f=image

I think the biggest requirement is the bounding box.

https://apps.fs.usda.gov/arcx/rest/services/RDW_Wildfire/MTBS_CONUS/MapServer/export?bbox=-14538132.889387406%2C2714574.244770844%2C-6996763.034785762%2C6670832.147551393

Those both get me something.

API Doc https://developers.arcgis.com/rest/services-reference/export-map.htm

3
  • I've tried using export but from what I can tell it can only export a compressed image rather than a spatially referenced image that can be used for further processing. Am I missing something? Sep 16, 2020 at 15:42
  • I think it "should" be spatially referenced, or at least you can specify a spatial Reference object, but it may just kick out an image. Depending on what you are trying to do with your script/program it may be better for you to try and pull in some kind of spatial handler or different API to point to just the straight MapServer instead of deducing all the rest calls yourself.
    – Ben
    Sep 16, 2020 at 19:03
  • Maybe with leaflet in R? medium.com/@joyplumeri/…
    – Ben
    Sep 16, 2020 at 19:05
0

Using QGIS and the url:

https://apps.fs.usda.gov/arcx/rest/services/RDW_Wildfire/MTBS_CONUS/

You have to pick a year 1984-2017

Shown is 2017

enter image description here

4
  • This works and I can also get it through ArcGIS online but my next step is to include the query into an R workflow so I'd like to get the REST query actually working. Sep 4, 2020 at 22:00
  • can you add your using R, I don't see that mentioned in your original question.
    – Mapperz
    Sep 4, 2020 at 22:02
  • I would export this to a GeoTiff and use R to do the rest.
    – Mapperz
    Sep 4, 2020 at 22:03
  • Sorry I haven't gotten to putting it into R yet as I can't figure out how to format the REST query so it works so I didn't include that. I'm trying to use the REST service instead of just downloading the Geo Tiff so I can update the data through code and for a specific geography rather than regularly downloading the full geo tiff. Also looking at this as potentially being put into a shiny dashboard so API for data would be ideal. Sep 4, 2020 at 22:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.