I've setup Proxy, the Overlay Proxy module and am now trying to show some GML layer data in the WMS block - I've turned off the Proxy whitelist and keep getting this printed in the block ("Array ( [0] => Invalid response: 404: Not Found ) ") when I click on a layer which I know has feature info that should be displaying. When I look at the recent Drupal log messages I see:

Notice: Undefined offset: 1 in wms_ajax_wmsgetfeatureinfo() (line 52 of /var/www/vhosts/sitename.org/dev/httpdocs/sites/all/modules/wms/wms.module).

When I look at like 52 of the wms.module I can see that the error seems to be generated from this line:

'layer' => $layertp[1],

(in the wms_ajax_wmsgetfeatureinfo() function.)

Additional notes:

  • I'm using Openlayers 7.x-2.0-beta7+24-dev
  • I'm using Openlayers Plus 7.x-3.0-beta1+15-dev

Any ideas/suggestions?

Also - where can I actually check the query which is being run in order to verify that it works along the lines of this example - which works:

http://128.100.66.64/cgi-bin/mapserv.exe?map=C:/ms4w/maps/wms_tilecache/...

Thanks,
Qasim

Comments

designguru’s picture

Issue summary: View changes

added module versions

batje’s picture

My first guess would be that the wms module has an issue with the spaces in the name of the layer.

If you want to see what happens in the module, you could always run the code through your debugger (or install the devel menu, and add some dpm($something) statements.

I wont be able to work on this issue in the next 2 weeks.

designguru’s picture

I'll try and run some tracking on the module through devel later today and post back with findings; I was testing with layers named 'wms_urban_growth' etc - so spaces shouldn't be a problem (the module should try and query by layer name not title right?)

q./

designguru’s picture

As it turns out, the Openlayers implementation we're using is generating layers in a non-standard way - so I need to call a different URL than the Base URL we've entered in the Drupal OpenLayers module:

Instead of:
http://128.100.66.64/cgi-bin/tilecache/tilecache.py?VERSION=1.1.1&REQUES... ....

It should be say:
http://128.100.66.64/cgi-bin/mapserv.exe?map=C:/ms4w/maps/wms_tilecache/... ....

Where 'wms_bnd_muniupper' is the name of the layer being called (the mapserver automatically creates the data as a layername.map file when it is queried.)

From looking at the WMS module code I'm confused as to where I would edit the module in order to override the base layer for the query.... I just can't see where its being called (assumedly I'd need to edit modules/wms/plugins/behaviors/js/openlayers_behavior_wmsgetfeatureinfo.js)

q./

designguru’s picture

I ended up customizing the code in openlayers_behavior_wmsgetfeatureinfo.js around line 100 to call the actual mapserv.eve URLs we need for this project as follows.

This meant replacing:

url: Drupal.settings.basePath + 'openlayers/wms/wmsgetfeatureinfo',

With:

var url = "http://128.100.66.64/cgi-bin/mapserv.exe?map=C:/ms4w/maps/wms_tilecache/" + wmslayers + ".map&VERSION=1.1.1&REQUEST=GetFeatureInfo&TRANSPARENT=true&FORMAT=image/png&INFO_FORMAT=gml&BBOX=" + layers[0].getExtent().toBBOX() + "&WIDTH=" + data.openlayers.size.w + "&HEIGHT=" + data.openlayers.size.h + "&LAYERS=" + wmslayers + "&QUERY_LAYERS=" + wmslayers + "&X=" + Math.round(evt.xy.x) + "&Y=" + Math.round(evt.xy.y) + "&SRS=" + projection;

Of course, you'll note that the above is querying per layer and the query gets messed up when multiple layers are active and someone clicks on them - unfortunately my javascript isn't very good so this is little cumbersome for me, but now it seems the task is to turn the above into something which works to query multiple layers...

Any help/insight is welcome...

q./

batje’s picture

In the .js the URL of the layer request is built up by calling this function:

http://dev.openlayers.org/docs/files/OpenLayers/Layer/WMS-js.html#OpenLa...

If you make sure that the first WMS layer is configured correctly in the OpenLayers backend, then theoratically it should work. Sorry, I havent tested this on anything else then linux + geoserver.

batje’s picture

Issue summary: View changes

example added

batje’s picture

Issue summary: View changes
Status: Active » Closed (cannot reproduce)