[GIS] Is it possible to get GeoJSON geometry from GetFeatureInfo WMS request from ArcGIS Server 10.x

arcgis-servergetfeatureinfowms

I'm trying to perform a GetFeatureInfo request to an ArcGIS server 10.x WMS service and would like to get a response in GeoJSON format including the feature geometry.

Here's the request:
http://mapservices.gov.yk.ca/arcgis/services/GeoYukon/GY_OilGas/MapServer/WMSServer?REQUEST=GetFeatureInfo&EXCEPTIONS=application%2Fvnd.ogc.se_xml&BBOX=-140.742239%2C64.444492%2C-131.499347%2C69.721576&SERVICE=WMS&INFO_FORMAT=application%2Fgeojson&QUERY_LAYERS=1&FEATURE_COUNT=50&Layers=1&WIDTH=578&HEIGHT=330&styles=&srs=EPSG%3A4326&version=1.1.1&x=201&y=207&

and the response contains a null geometry.

{
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
       "geometry": null,
       "properties": {
       "OBJECTID": "7",
       "SHAPE": "Polygon",
       "SEDIMENT_BASIN_NAME": "Eagle Plain",
       "SEDIMENT_BASIN_ID": "E",
       "BASIN_LOCATION": "onshore",
       "DESCRIPTION": "Northern Yukon Fold Complex",
       "REGION_NAME": "North Yukon",
       "AREA_KILOMETRES": "20803.8",
       "AREA_ACRES": "5140816.4",
       "AREA_HECTARES": "2080375.7",
       "SHAPE.AREA": "20803756917.106998",
       "SHAPE.LEN": "1391344.050657"
     },
     "layerName": "1"   
  }
 ]
}

Is it possible to get the geometry in GeoJSON or another format, perhaps by configuring the ArcGIS Server?

Best Answer

My original answer is below the line but I am having second thoughts about it. This is because the ArcGIS Server 10 Help page entitled Customizing a WMS GetFeatureInfo response says:

ArcGIS Server comes with XSLT templates for the supported formats listed in the WMS's capabilities files. For example, if you open the directory of these templates at \Styles\WMS, you'll see the following:

  • featureinfo_application_geojson.xsl
  • etc

As their name implies, each template is used to produce a default GetFeatureInfo response in a readable format, such as GeoJSON, plain text, and XML.


You will not be able to retrieve feature geometry from an OGC Web Mapping Service (WMS) which is simply served as an image (raster).

In order to request a feature geometry (vector) from ArcGIS for Server I think you will need to use one of:

  • ArcGIS for Server Feature Service
  • ArcGIS for Server Geometry Service
  • OGC Web Feature Service (WFS)
Related Question