[mapserver-users] WMSGetFeautureInfo

Stephen Woodbridge woodbri at swoodbridge.com
Sat Nov 21 13:28:05 PST 2009


Hi Peter,

Since I just struggle my through this exact example, I think I might be 
able to help :)

Peter Huis in 't Veld wrote:
> Hi,
> 
> I'm trying to set up a WMS service with the possibility to obtain a 
> popup containing the feature items.
> 
> the components I''m using is:
> - Openlayer
> - Mapserver
> 
> Testing it I can visualize all items but I get the following error 
> message :
> 
> Message: Object doesn't support this property or method
> Line: 229
> Char: 9
> Code: 0
> URI: http://myserver/lib/OpenLayers/Handler/Feature.js
> 
> Looking at the code it looks like it has something to with the 
> evalaution of the mouse click event
> 
> I've three questions:
> - Could someone explain a bit more about this error?
> - Should I stick with WMS or should I use WFS?
> - Does someone has some advice what might cause a problem based on the 
> code snippet underneath?
> 
> Thanks in advance for any support
> 
> Peter
> 
> 
> --------------------
> Within in my webpage I've some javascript looking like:

The problem is that you need to declare you layer as a global:


var test;

>   function init() {

         test =  = new OpenLayers.Layer.WMS( ... );

>   ....
>         info = {
>           click: new OpenLayers.Control.WMSGetFeatureInfo({
>            'url': 'http://cccc',
>            'title': 'Identify features by clicking',

then change the next line to be:
              'layers': [test],

>            'layers': "test",

I think that might fix things up for you.

-Steve W


>            'queryVisible': true
>           })};
>        for (var i in info) {
>            info[i].events.register("getfeatureinfo", this, showInfo);
>            map.addControl(info[i]);
>        }
> 
>      info.click.activate();
>   ....
>   }
> 
>    function showInfo(evt) {
>        if (evt.features && evt.features.length) {
>             highlightLayer.destroyFeatures();
>             highlightLayer.addFeatures(evt.features);
>             highlightLayer.redraw();
>        } else {
>            $('responseText').innerHTML = evt.text;
>        }
>    }
> 
> 
> 
> In mapserver I've defined the layer and all wms_... parameters
> LAYER
> 
>  METADATA
>      "wms_title" "IVS90 Stremmingen"
>      "wms_include_items" "all"
>       "wms_feature_info_mime_type" "text/html"
>   END
> 
>  TYPE POINT
>  TOLERANCE 10
>  TOLERANCEUNITS kilometers
>  ...
> 
>  CLASS
>       TEMPLATE "template.html"
>       ...
>  END
> 
> END
> 
> 
> 
> 
> 
> 
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users




More information about the MapServer-users mailing list