AnsweredAssumed Answered

How to perform a spatial query on map service from Identify widget

Question asked by guess on Sep 9, 2015
Latest reply on Sep 15, 2015 by guess

I'm utilizing Robert Scheitlin's Identify widget and I'm trying to query another map service based on each result items feature centerpoint to return attributes from the map service to be used as parameters in a link within each identify result.  I have the link params established within the identify_config file with the "content" element set to " ", which will be populated once the spatial query is complete with the appropriate values.  What I have so far is that when the user Identify's for the first time, the spatial query values are null.  When the user performs another Identify, the query values are now populated, however, they are from the previous Identify result.  Also, if the user selects any other Identify geometry other than "point", it doesn't work. 

 

In my old flex app, I was able to achieve this when the user clicked on the link within the identify result item.  With that, it would grab the items centerpoint and use that as query geometry for the specific map service.  The query was an AsyncResponder (asynchronous) function and would then loop through the designated outFields to populate params and update the url used for the link.  Since javascript is not asynchronous, I'm not quite sure how to implement this correctly.

 

I currently have my code placed within the showIdentifyResults() function which calls another function (_queryFeatureSub) and passes the identifyGeom parameter.  Within the _queryFeatureSub() function is where I query the map service via QueryTask and loop through the attributes to pull the data I need.  Later in the showIdentifyResults() function, I loop through the idResult.links, find the specific link I need, and update it with the specific link url populated from the query params.

 

I think I might need to use Deferred() but not quite sure how to implement this.  Or, I might be totally wrong with my thought process.  If anyone has some thoughts or input, I'd really appreciate it!

 

Thanks

Outcomes