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

Ralph Dell RDell at CatawbaCountyNC.gov
Thu Mar 6 05:36:21 PST 2014


I believe OpenLayer.Control.WMSGetFeatureInfo will do what you are requesting.
Is that enough to get you going?

-----Original Message-----
From: openlayers-users-bounces at lists.osgeo.org [mailto:openlayers-users-bounces at lists.osgeo.org] On Behalf Of ink
Sent: Thursday, March 06, 2014 12:57 AM
To: openlayers-users at lists.osgeo.org
Subject: [OpenLayers-Users] how to get WMS feature attribute informations

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.
_______________________________________________
Users mailing list
Users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/openlayers-users


More information about the Users mailing list