[OpenLayers-Users] how to get WMS feature attribute informations

ink ino_shani at yahoo.com
Wed Mar 5 21:57:06 PST 2014


var format = "application/vnd.ogc.gml";
var kdistrict_schl = new OpenLayers.Layer.WMS(
        "School locations - Kandy", "http://localhost:8080/geoserver/wms",
        {
        layers: 'admission:kdistrict_schl',
         queryVisible: true,
		infoFormat: format,
        transparent: true,
        styles: 'point'
        },
        {singleTile: true, buffer:0, ratio: 1}
);
   



	// create a vector layer for drawing
    var vector = new OpenLayers.Layer.Vector("Editable Vectors");

	
	 //'Click' can be replaced with 'Over' for hovering capability
            var OVER1 = new OpenLayers.Control.SelectFeature(kdistrict_schl,
{callbacks: {'click':feature_info,}});
			
            map.addControl(OVER1);
          OVER1.activate();
		  
	
			
			 //Get attribute information (Source:
http://openlayers.org/dev/examples/openmnnd.html)
        function feature_info(feature) {
            var html = "<ul>";
            for(var i in feature.attributes)
               html += "<li>*" + i + "*: "+  feature.attributes[i] +
"</li>";
            html += "</ul>";
            OpenLayers.Util.getElement('feature_info').innerHTML = html;
        }
	
	// click event n get lat lon coordinates
	

   map.addLayers([
        gphy, gmap, gsat, ghyb, veroad, veaer, vehyb, mapnik,
vector,kdistrict_schl
    ]);
i used above code to get attribute informations in WMS LAYER. but not
working??



--
View this message in context: http://osgeo-org.1560.x6.nabble.com/how-to-get-WMS-feature-attribute-informations-tp5107821.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.


More information about the Users mailing list