TransWikia.com

Read the attributes of a WMS layer by clicking on the map

Geographic Information Systems Asked by work on December 15, 2020

I’m trying to display a popup (containing the attribute data) by clicking on an entity in my layer with the WMSGetFeatureInfo control from OpenLayers. It’s turning but without displaying the popup

Note: I’m working with OpenLayers-2.13.1 , geoext2-2.1.0, ext-js-gpl-master

var info = Ext.create('GeoExt.Action',{
  tooltip: "Feature Info",
  icon:"Librs/geoext2-2.1.0/resources/images/default/information.png",
  text: "Get Info",
  enableToggle: true,
  allowDepress: true,
  enableToggle: true,
  control: new OpenLayers.Control.WMSGetFeatureInfo({
    //autoActivate: true,
    url: "http://localhost:8081/geoserver/STAGE/wms",
    title: 'Identify features by clicking',
    queryVisible: true,
    eventListeners: {
      getfeatureinfo: function(event) {   
        if(popup) {map.removePopup(popup);}
        popup = new OpenLayers.Popup.FramedCloud(
        "getInfo", 
        map.getLonLatFromPixel(event.xy),
        null,
        event.text,
        null,
        true
      );        
      map.addPopup(popup, true);
      }
    }
  }),
  map: map,
  toggleGroup: 'tools'
});

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP