Re: [mapserver-users] getFeatureInfo() Only Works on One Layer?
Bill, Try separating the QUERY_LAYERS with a space rather than a comma. MapServer uses space delimited values (gets changed to + separated in the URL). Mike -- Michael Smith RSGIS Center ERDC - CRREL US Army Corps of Engineers On 1/27/09 6:13 PM, Bill Thoen bth...@gisnet.com wrote: I originally asked this on the OpenLayers forum, but was told that this is really a Maperver question. So I'll try it here. I've got a WMS layer that has two sub-layers in it and I'm trying to get attribute information from them via a getFeatureInfo request, but I can only get one of them to respond at a time. I've looked at the docs at http://trac.openlayers.org/wiki/GetFeatureInfo and noticed that you can specify several layers with the QUERY_LAYERS parameter, but I'm finding that only the one listed first is active. Also, it's not clear what layer you specify at the root of the request, but it looks like it's supposed to be different from the layers you're querying. Anyway, here's what I'm trying: I open and load the combined layer like so: base = new OpenLayers.Layer.WMS( Base, http://192.168.0.250/cgi-bin/mapserv?map=base.map;, { layers: [us_states, us_interstate] } ); map.addLayer(base); And here's the request string I'm sending to MapServer: var url = base.getFullRequestString({ REQUEST: GetFeatureInfo, EXCEPTIONS: application/vnd.ogc.se_xml, FORMAT: 'png', BBOX: map.getExtent().toBBOX(), X: event.xy.x, Y: event.xy.y, INFO_FORMAT: 'text/plain', QUERY_LAYERS: us_interstate, us_states, FEATURE_COUNT: 1, WIDTH: map.size.w, HEIGHT: map.size.h}, http://192.168.0.250/cgi-bin/mapserv?map=base.map;); OpenLayers.loadURL(url, '', this, setHTML); Note the QUERY_LAYERS line. As shown here, it responds with interstate attributes only when I click on an interstate roadway feature, but I get nothing when I click on a state. If I reverse the order of these layers in the list, then clicking on a state returns attributes from the us_states table only. Even if I click on a spot where features in both layers coincide, it returns only the attributes for the layer listed first. Also, setting the FEATURE_COUNT parameter to something higher than 1 just gives me more results from the single that is working. So how do I use multiple layers in the QUERY_LAYERS parameter, or do I get only one at a time? Also, I just guessed at using the layer called 'base' for the getFeatureInfo oject, what is supposed to be used here? TIA, - Bill Thoen ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] getFeatureInfo() Only Works on One Layer?
No, that's not it. I tried both a space and a '+' instead of the comma, but neither worked. Michael Smith wrote: Bill, Try separating the QUERY_LAYERS with a space rather than a comma. MapServer uses space delimited values (gets changed to + separated in the URL). Mike ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] getFeatureInfo() Only Works on One Layer?
On Tue, Jan 27, 2009 at 05:36:12PM -0700, Bill Thoen wrote: No, that's not it. I tried both a space and a '+' instead of the comma, but neither worked. Bill, As I suggested before, I highly recommend taking the *actual URL*, and tweaking that, without the interference of OpenLayers in the middle. If you can share a URL that's not working, especially against a liveserver, that would probably be helpful to all involved. Regards, -- Christopher Schmidt MetaCarta ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] getFeatureInfo() Only Works on One Layer?
Bill, You might try setting the layers in the QUERY_LAYERS parameter without any space: QUERY_LAYERS: us_interstate,us_states. If that does not work, as suggested you might give the full URL sent to Mapserver. From what I can see, query on more that one layer is possible (URL using the Mapserver5.2.1 : http://www2.dmsolutions.ca/cgi-bin/mswms_gmap?SERVICE=WMSVERSION=1.1.1REQUEST=GetFeatureInfoBBOX=-173.433000,36.354100,-12.969800,83.746600SRS=EPSG:4326WIDTH=785HEIGHT=232LAYERS=park%2CpopplaceSTYLES=%2CFORMAT=image/pngTRANSPARENT=TRUEQUERY_LAYERS=popplace,parkINFO_FORMAT=text/plainX=302Y=121feature_count=1 Best Regards. Bill Thoen wrote: I originally asked this on the OpenLayers forum, but was told that this is really a Maperver question. So I'll try it here. I've got a WMS layer that has two sub-layers in it and I'm trying to get attribute information from them via a getFeatureInfo request, but I can only get one of them to respond at a time. I've looked at the docs at http://trac.openlayers.org/wiki/GetFeatureInfo and noticed that you can specify several layers with the QUERY_LAYERS parameter, but I'm finding that only the one listed first is active. Also, it's not clear what layer you specify at the root of the request, but it looks like it's supposed to be different from the layers you're querying. Anyway, here's what I'm trying: I open and load the combined layer like so: base = new OpenLayers.Layer.WMS( Base, http://192.168.0.250/cgi-bin/mapserv?map=base.map;, { layers: [us_states, us_interstate] } ); map.addLayer(base); And here's the request string I'm sending to MapServer: var url = base.getFullRequestString({ REQUEST: GetFeatureInfo, EXCEPTIONS: application/vnd.ogc.se_xml, FORMAT: 'png', BBOX: map.getExtent().toBBOX(), X: event.xy.x, Y: event.xy.y, INFO_FORMAT: 'text/plain', QUERY_LAYERS: us_interstate, us_states, FEATURE_COUNT: 1, WIDTH: map.size.w, HEIGHT: map.size.h}, http://192.168.0.250/cgi-bin/mapserv?map=base.map;); OpenLayers.loadURL(url, '', this, setHTML); Note the QUERY_LAYERS line. As shown here, it responds with interstate attributes only when I click on an interstate roadway feature, but I get nothing when I click on a state. If I reverse the order of these layers in the list, then clicking on a state returns attributes from the us_states table only. Even if I click on a spot where features in both layers coincide, it returns only the attributes for the layer listed first. Also, setting the FEATURE_COUNT parameter to something higher than 1 just gives me more results from the single that is working. So how do I use multiple layers in the QUERY_LAYERS parameter, or do I get only one at a time? Also, I just guessed at using the layer called 'base' for the getFeatureInfo oject, what is supposed to be used here? TIA, - Bill Thoen ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users -- Assefa Yewondwossen Software Analyst Email: ass...@dmsolutions.ca http://www.dmsolutions.ca/ Phone: (613) 565-5056 (ext 14) Fax: (613) 565-0925 ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] getFeatureInfo() Only Works on One Layer?
Well, when I moved the application to a publicly-accessible server to show you all, it worked as it should. Turns out my server has the latest version of MapServer installed, but my workstation is running an older one, and so I guess the problem got fixed in the newer release. Yewondwossen Assefa wrote: Bill, You might try setting the layers in the QUERY_LAYERS parameter without any space: QUERY_LAYERS: us_interstate,us_states. If that does not work, as suggested you might give the full URL sent to Mapserver. From what I can see, query on more that one layer is possible (URL using the Mapserver5.2.1 : http://www2.dmsolutions.ca/cgi-bin/mswms_gmap?SERVICE=WMSVERSION=1.1.1REQUEST=GetFeatureInfoBBOX=-173.433000,36.354100,-12.969800,83.746600SRS=EPSG:4326WIDTH=785HEIGHT=232LAYERS=park%2CpopplaceSTYLES=%2CFORMAT=image/pngTRANSPARENT=TRUEQUERY_LAYERS=popplace,parkINFO_FORMAT=text/plainX=302Y=121feature_count=1 Best Regards. Bill Thoen wrote: I originally asked this on the OpenLayers forum, but was told that this is really a Maperver question. So I'll try it here. I've got a WMS layer that has two sub-layers in it and I'm trying to get attribute information from them via a getFeatureInfo request, but I can only get one of them to respond at a time. I've looked at the docs at http://trac.openlayers.org/wiki/GetFeatureInfo and noticed that you can specify several layers with the QUERY_LAYERS parameter, but I'm finding that only the one listed first is active. Also, it's not clear what layer you specify at the root of the request, but it looks like it's supposed to be different from the layers you're querying. Anyway, here's what I'm trying: I open and load the combined layer like so: base = new OpenLayers.Layer.WMS( Base, http://192.168.0.250/cgi-bin/mapserv?map=base.map;, { layers: [us_states, us_interstate] } ); map.addLayer(base); And here's the request string I'm sending to MapServer: var url = base.getFullRequestString({ REQUEST: GetFeatureInfo, EXCEPTIONS: application/vnd.ogc.se_xml, FORMAT: 'png', BBOX: map.getExtent().toBBOX(), X: event.xy.x, Y: event.xy.y, INFO_FORMAT: 'text/plain', QUERY_LAYERS: us_interstate, us_states, FEATURE_COUNT: 1, WIDTH: map.size.w, HEIGHT: map.size.h}, http://192.168.0.250/cgi-bin/mapserv?map=base.map;); OpenLayers.loadURL(url, '', this, setHTML); Note the QUERY_LAYERS line. As shown here, it responds with interstate attributes only when I click on an interstate roadway feature, but I get nothing when I click on a state. If I reverse the order of these layers in the list, then clicking on a state returns attributes from the us_states table only. Even if I click on a spot where features in both layers coincide, it returns only the attributes for the layer listed first. Also, setting the FEATURE_COUNT parameter to something higher than 1 just gives me more results from the single that is working. So how do I use multiple layers in the QUERY_LAYERS parameter, or do I get only one at a time? Also, I just guessed at using the layer called 'base' for the getFeatureInfo oject, what is supposed to be used here? TIA, - Bill Thoen ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users