Sunday, 18 February 2018

arcgis javascript api - How to determine the accuracy of getFeatureInfo on a WMS layer?


I have added a WMS layer to the ArcGIS Server JSAPI and am attempting to query it using getFeatureInfo when the user clicks on the map.


This is mostly working, except that the accuracy of the results is very suspicious. If I click within a few hundred metres of a polygon boundary, I often get back the neighbouring polygon's results:



enter image description here


In this case I have clicked within Staffordshire Moorlands 010B (as shown by the infoWindow's anchor) but the result shows the neighbouring polygon 011C.


In order to run the getFeatureInfo, I am calculating the map extent in its native web mercator, converting this into the units of the WMS layer, and using this as the bounding box.


Is this a valid approach?


The question ArcGIS Server WMS GetFeatureInfo tolerance implies that there may be some trickery required to get the tolerance right?



Answer



By extracting parameters while debugging your website, I found the following: The X and Y position is somewhat wrong.


The screenshot shows the info box where I clicked, and the red dot shows the actual X and Y position that is submitted in GetFeatureInfo. So it apparently looks like I clicked in the 010B polygon, but the submitted X and Y is actually inside 011C. So, there is absolutely nothing wrong with the server result here !


Perhaps the X and Y is relative to a wrong element or something like that ?


enter image description here



No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...