1

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?

9
  • I doubt this has anything to do with pixel tolerance. Do you use the same extent as in the GetMap request ? (you should)
    – Oyvind
    Aug 22, 2013 at 15:39
  • Just checking but are you including a transformation when you convert to the WMS layer's CRS (I assume it's 27700, BNG)?
    – mkennedy
    Aug 22, 2013 at 16:05
  • @Oyvind I'm using "new esri.layers.WMSLayer()" to create the layer, so the JSAPI builds an automatic GetMap request each time the extent changes. Firebug shows that GetMap is using 102100 while GetFeatureInfo is using 4326. I'll investigate this further - thanks Aug 22, 2013 at 17:43
  • @mkennedy I'm a little confused about transformations in the geometryService.project - can you give me an example? The documentation is a bit vague in this area. Thanks Aug 22, 2013 at 17:44
  • I'm a bit confused by the help too! If you are using 102100/4326, no transformation is needed. If there is a 27700 in the mix somewhere, try 1314, OSGB_1936_To_WGS_1984_6.
    – mkennedy
    Aug 22, 2013 at 18:29

1 Answer 1

2

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

1
  • Bingo - I was using the onClick event's evt.screenX and .screenY - this is subtly different to evt.screenPoint.x (possibly a bug). Thanks! Aug 24, 2013 at 8:52

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.