[OpenLayers-Users] getFeatureInfo() Only Works on One Layer?

Bill Thoen bthoen at gisnet.com
Wed Jan 28 16:32:07 EST 2009


Thanks, but it turned out that the real problem was running an old 
version (4.10.0) of MapServer.  When I upgraded to 5.2.1 this morning, 
my application worked without a problem.

Now I'm finding out new quirks of the getFeatureInfo procedure. For 
example, it searches for the *nearest* objects in each of the 
QUERY_LAYERS and returns FEATURE_COUNT records from each. You don't have 
to click on an object exactly to find it. Also, even if objects in a 
layer are not visible due to exceeding a maxscale or minscale setting,  
it still sees them and includes these records in what it returns if they 
are closer than records that are visible. But at least it's working now 
and will solve my problem of providing data attributes for features in 
WMS layers.

- Bill Thoen


Arnd Wippermann wrote:
> Hi Bill,
>
> You have to delete the blank in QUERY_LAYERS: "us_interstate,us_states" 
>
> A documentation for WMS parameters are availible from OGC. They are
> responsibable for WMS, WFS and other standards. 
>
> http://www.opengeospatial.org/standards/wms
>
> Arnd Wippermann
>
>
>
> -----Ursprüngliche Nachricht-----
> Von: users-bounces at openlayers.org [mailto:users-bounces at openlayers.org] Im
> Auftrag von Bill Thoen
> Gesendet: Dienstag, 27. Januar 2009 22:59
> An: users at openlayers.org
> Betreff: [OpenLayers-Users] getFeatureInfo() Only Works on One Layer?
>
> 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.
>
> 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 beused here?
>
> TIA,
> - Bill Thoen
>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>
>   




More information about the Users mailing list