I'm new to WMS layers, and am looking for a way to retrieve a layer's attributes when clicking on the map, using the ArcGIS Server JS API.
The documentation is a bit sparse, but from this question it appears that I'll need to construct a query using GetFeatureInfo.
Before I re-invent the wheel, has anyone written a wrapper function or sample code which builds the appropriate query when the user clicks on the map?
1 Answer 1
The WMS GetFeatureInfo request is very similar to the GetMap request. There is an example here showing code sample for GetFeatureInfo.
Also, keep in mind, that the GetFeatureInfo is not "standardized", so depending on server vendor, the response is differently formatted. Expect to do some extra parsing/styling.
-
I ended up running a GetCapabilities, then using its values to run a GetFeatureInfo, with the height, width, extent and X/Y values calculated from the map on mouse click. Thanks for the pointer.Stephen Lead– Stephen Lead2013年08月21日 21:34:12 +00:00Commented Aug 21, 2013 at 21:34
-
I've now run into a further problem if you have a chance to look: gis.stackexchange.com/questions/69420/… - thanksStephen Lead– Stephen Lead2013年08月22日 15:06:55 +00:00Commented Aug 22, 2013 at 15:06