If you are getting map data from a WMS service that supports GetFeatureInfo
requests, you can request information about the properties of the features at a certain location.
To enable GetFeatureInfo
requests, specify the queryLayers
option when you construct your WMS model.
Then, create a WMS layer that corresponds to your WMS model:
-
If you have a
WMSImageModel
, create aWMSImageLayer
-
If you have a
WMSTileSetModel
, create aWMSTileSetLayer
Once you added the WMS layer to a Map
, you can call the getFeatureInfo
method with view coordinates.
The GetFeatureInfo
request determines which feature is painted on the view at that location.
The call returns a Promise
to the requested feature information and its metadata.
The Data Formats sample and the ECDIS sample show the usage of the GetFeatureInfo
request with WMS layers.
More specifically, the GetFeatureInfoController
class in the RIA toolbox uses the getFeatureInfo
methods of the WMS layers to retrieve feature information at the mouse location, and shows that information on the map.