Survey123 Javascript extension - Identify pixel value from image server

736
2
06-18-2019 11:26 AM
DerrickWestoby1
New Contributor III

Good Morning, 

I'm working on a Survey123 form for our geology group where I'm trying to make use of some of the ESRI Living Atlas image layers, but I'm not sure how to return the pixel value at a specified coordinate to populate a field in my Survey123 form.   I've been able to get a point-in-polygon/feature query to work by adapting the "Spatial Inheritance" example script posted to the early adopter's community (attached), but I'm not sure how to pull values out of raster layers. 

Just as a heads-up, I'm brand-spanking-new to any sort of programming/coding (<3months) and I just started working on learning Javascript last week. I'm hoping that someone here can help me construct a simple function that will query a specified image service URL at a geopoint location and then return the pixel value for that location.  

Here's the living atlas layer that I'm currently trying to get working - https://landscape11.arcgis.com/arcgis/rest/services/USA_Soils_Water_Table_Depth/ImageServer  

I'm not sure what information is needed or would be relevant to help with this question, so here's some info off the top of my head: 

-We do not have our own GIS servers, everything is hosted in our AGOL organization

-On-line mapping/surveys only

-I'd prefer to do any unit type conversions/calculations in the XLS form instead of the .JS, just because I understand that process better and it would make it easier for me to learn & understand the js. 

- Not sure what other information is useful? 

Working .js file for queryFeature that I'm currently using is attached, and thank you for any help. 

2 Replies
JamesTedrick
Esri Esteemed Contributor

Hi Derrick,

Identify (Image Service)—ArcGIS REST API: Services Directory | ArcGIS for Developers is the request you would want to work with.  The pattern is similar to the query; as an example:

https://landscape11.arcgis.com/arcgis/rest/services/USA_Soils_Water_Table_Depth/ImageServer/identify...  will get a result.

Most of this is a set pattern; you would need to dynamically add the location based on the x & y coordinates.

DerrickWestoby1
New Contributor III

Thanks James.  I've been able to construct the URL and successfully send the request from Survey123 using a javascript file, but I have not been able to return a JSON object that contains the pixel value.  Basically, I can do everything up to sending the request, but I don't know what to do with the response.   I've tested the constructed URL in Postman as well, and I am getting a response in there (including pixel value). 

0 Kudos