0

I am consuming a GeoServer WMS layer in ArcGIS JavaScript API. I am successfully able to display layer. Now I am not able to get layer info on map click or layer click.

Below is code using to add GeoServer WMS layer, how can I get the layerinfo?

var layer1 = new WMSLayerInfo({
    'id': '1',                                 
    name: 'xxx:yyy',
    title: 'nrega',
    queryable: true,
    });
var resourceInfo = {
    featureInfoFormat: "text/html",
    infoTemplate: infoTemplate,
    tolerance: 10,
    extent: new Extent(7971379.79404854, 1129044.28557475, 9134620.92140827, 2217652.68573662, new SpatialReference({
        "wkid": 4326
        })),
    getFeatureInfoURL: "https://adcd/xyz/ows/?service=WMS&version=1.3.0&info_format=application/json&xsl_template=infoTemplate.xsl",  
    layerInfos: [layer1]
    };
var wmsLayer = new WMSLayer("https://adcd/xyz/wms/", {
                                resourceInfo: resourceInfo,
                                visibleLayers: ['xxx:yyy'],
                                visible: true
    });
wmsLayer.spatialReferences[0] = 3857;
wmsLayers = wmsLayer;
map.addLayers([wmsLayers]);
  • What GetFeatureInfo request is sent – nmtoken Mar 28 at 7:44
  • 1
    In your code you have featureInfoFormat: "text/html", but in the getFeatureInfoURL: you have info_format=application/json& those appear to be conflicting statements – nmtoken Apr 1 at 16:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.