I am not sure if this is even possible but is it possible to automatically populate answers in a survey based on a individual's location/geopoint? I have a survey in which employees fill out a job report and some of the questions include which district and what zone they are in, as well as create a geopoint on a map.
In order to save them time, I was wondering if it is possible to reference their geopoints to a map of the districts/zones and get information on where they are? I know it might be unlikely but I would love to hear any ideas.
Solved! Go to Solution.
Hi
This is totally possible if you have a logged in user - you can perform a live query via JavaScript to a feature layer and extract information based on, for instance, the closest or an intersecting facility by using the ArcGIS REST API:
var url = featureLayer + "/query?where=1=1&geometry=" + coords + "&geometryType=esriGeometryPoint&inSR=4326&spatialRel=esriSpatialRelIntersects&outFields=*&returnGeometry=false&returnCount=1&f=json"
You can then manipulate the return of the call to retrieve the attributes and use them in your survey:
return JSON.stringify(responseJSON.features[0]);
pulldata("@javascript","myFunctions.js","queryPolygon",string(${location}),true) |
pulldata("@json",${my_json},"attributes.Region") |
Please see this blog for more info:
Hi
This is totally possible if you have a logged in user - you can perform a live query via JavaScript to a feature layer and extract information based on, for instance, the closest or an intersecting facility by using the ArcGIS REST API:
var url = featureLayer + "/query?where=1=1&geometry=" + coords + "&geometryType=esriGeometryPoint&inSR=4326&spatialRel=esriSpatialRelIntersects&outFields=*&returnGeometry=false&returnCount=1&f=json"
You can then manipulate the return of the call to retrieve the attributes and use them in your survey:
return JSON.stringify(responseJSON.features[0]);
pulldata("@javascript","myFunctions.js","queryPolygon",string(${location}),true) |
pulldata("@json",${my_json},"attributes.Region") |
Please see this blog for more info:
Wow, thanks! I will try to play around with this and see if I can get this to work.
@DeonLengton , is it possible to go one step further and populate a survey question based on features in the current map extent? eg: if i zoom in tight enough so there's only a single hydrant displayed the survey auto-populates with that Hydrants ID?