[GIS] Openlayers WMS getFeatureInfo get features with geometry attribute

geometrygetfeatureinfoopenlayers-2wms

I am displaying map using WMSlayer and implemented WMSGetFeatureInfo control on wms layer. Tap on a location and get the features using WMS getFeatureInfo service. This service is returning me all the features are located at given Point successfully with feature attributes.

My Requirement

Along with the Feature attributes, i need to have the feature geometry information too, which not geting as part of feature information from service.

So is there any way to capture the geometry information from OpenLayers GetFeatureInfo control?

Or

Is that a limitation in WMS GetFeatureInfo service?

Best Answer

It is up to the WMS server admin which formats the server is configured to support for GetFeatureInfo. Check from the GetCapabilities of the WMS server the list of supported INFO_FORMATs.

Geoservers by default support geojson and GML info formats and those include also geometries with GetFeatureInfo results. You can try with the following links:

http://demo.opengeo.org/geoserver/wms?bbox=-100.00,35.00,-99.99,35.01&styles=&format=jpeg&request=GetFeatureInfo&layers=topp:states&query_layers=topp:states&width=2&height=2&x=1&y=1&info_format=application/json

http://demo.opengeo.org/geoserver/wms?bbox=-100.00,35.00,-99.99,35.01&styles=&format=jpeg&request=GetFeatureInfo&layers=topp:states&query_layers=topp:states&width=2&height=2&x=1&y=1&info_format=application/vnd.ogc.gml