Cesium WMS default getFeatureInfo

Hi all,

I am trying to do a getFeatureInfo request on a WMS layer loaded in Cesium.

I saw that there is a parameter in the WMSImageryProvider that enables the getFeatureInfo operation.

I was wondering how to get the response from the getFeatureInfo that Cesium does as default and store it for later use/display.

Thanks for your time,
Matteo

I'm stuck at the same point!

I read the documentation but I can't figure out how I can use the PickFeatures function in order to get the Promise back and display the results.

Any suggestion?
Thanks,
Michele

Hi, have you seen the example in the reference documentation for ImageryLayerCollection.pickImageryLayerFeatures?

http://cesiumjs.org/Cesium/Build/Documentation/ImageryLayerCollection.html#pickImageryLayerFeatures

Kevin

Hi Kevin,

thank you for your reply... I had a look at the link... and this was what I really needed, but our servers don't accept the mime type application/json and text/xml...

We have to request text/plain. I tried to forced this format as follow:

var wmsprovider = new Cesium.WebMapServiceImageryProvider({
      url: serviceURL,
      layers: layersName,
      enablePickFeatures : true,
      getFeatureInfoAsXml : false,
      getFeatureInfoAsGeoJson : false,
      getFeatureInfoParameters : {
        info_format : 'text/plain'
      },
      parameters : {
        transparent: 'true',
        format: 'image/png',
        crs: 'EPSG:4326'
      }
    });

but the Promise isn't raised with this method. Is there another way?

I tried to find a workaround and I looked into Cesium code, more in specific at:
https://github.com/AnalyticalGraphicsInc/cesium/blob/1.8/Source/Scene/WebMapServiceImageryProvider.js

and I customized my script, based on this, in order to calculate the right parameters to build my own URL.

If you have any other suggestion, is more than welcome!
Thanks,

Michele

What sort of WMS server are you talking to? What does it return when you request text/plain? Cesium currently requires that the GetFeatureInfo response be either JSON or XML (with any info_format). That requirement could potentially be relaxed.

Kevin

Hi,

the services are exposed by MapServer and this an example of request:

http://wms.pcn.minambiente.it/ogc?map=/ms_ogc/WMS_v1.3/Vettoriali/Autorita_bacino.map&service=WMS&version=1.3.0&width=256&height=256&request=getFeatureInfo&i=143&j=231&crs=EPSG:4326&info_format=text/plain&bbox=42.1875,11.250000000000012,45,14.062500000000004&query_layers=ZG.AUTORITABACINO&layers=ZG.AUTORITABACINO

In the input handler of the viewer I setup the pickImageryLayerFeatures as described in the documentation.

Hi,

You may be interested that we just merged a change to WebMapServiceImageryProvider to make it automatically support “text/html” GetFeatureInfo out of the box. You can also make it request any MIME type and specify an optional processing function to turn the response into ImageryLayerFeatureInfo. This will ship in Cesium 1.10 the first week of June.

https://github.com/AnalyticalGraphicsInc/cesium/pull/2723

Kevin

Hi Kevin,

Great! I know that the text/plain is not the best output... but we have no control on the server side...

Thank you for the support,
Michele