Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have used your code for picking feature info from wms layer using WMSGetFeatureInofo function.I have used you this link. but I cant found the feature info. feature.length function returns 0.

My wms layer is

 tiled = new OpenLayers.Layer.WMS( 
                    "unit_project2_ws:unit_project3_view - Tiled", 
                        LAYERS: 'unit_project2_ws:unit_project3',
                        transparent: true,
                        STYLES: '',
                        format: format,
                        tiled: true,
                        tilesOrigin : map.maxExtent.left + ',' + map.maxExtent.bottom

                        buffer: 0,
                        displayOutsideMaxExtent: true,
                        isBaseLayer: false,
                        yx : {'EPSG:900913' : false}


code i have used to get feature info from wms layer

roadidPicker = new OpenLayers.Control.WMSGetFeatureInfo({
                url: 'http://localhost:8080/geoserver/unit_project2_ws/wms',>
                title: 'identify features on click',
                layers: [tiled],
                queryVisible: true
roadidPicker.infoFormat = 'application/vnd.ogc.gml';"getfeatureinfo", this, pickRoadid);

function pickRoadid(e) {
  if (e.features && e.features.length) {
     var val = e.features[0];
     //document.getElementById('roadId').value = val;
      alert(e.features.length);  // this function returns 0 result.


What is problem with this code.

share|improve this question
Can u please provide the working code... – user14362 Jan 18 '13 at 9:51

I would get rid of those html
tags in your code. I really do not know if that is your problem but I have never seen that.

share|improve this answer
oh,sory,tags have been removed now,that was my negligency,Problem is code else than html tags,Now check the code and answer me. – Aftab Ahamad Sep 19 '12 at 5:13
I dropped the WMSGetFeatureInfo code and the pickRoadid function into a map and they worked for me on a wms layer. I had a featurelength. What happens when you change your url to localhost:8080/geoserver/wms';? – Ralph Dell Sep 19 '12 at 14:00

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.