[Geoserver-users] [1.6.0]GetFeatureInfo and multiple layers

I'm experiencing some troubles using GeoServer as WMS, so I need some suggests.
I'm using OpenLayers to show a single wms layer that is composed from
multiple GeoServer WMS layers; this means that when i click on my
objects I make a WMS GetFeatureInfo call with this parameters:
LAYERS=LAYER1,LAYER2,LAYER3&QUERYLAYERS=LAYER1,LAYER2,LAYER3.
I'm expecting that geoserver parses all layers for one or more
features, but I'm experiencing that only the first layer is called for
getfeatureinfo.
This means that in the query shown earlier, if i click on an object of
LAYER2, the feature is not retrieved, but if I hide LAYER1, so LAYER2
is the first layer in the query, I could retrieve feature information.
Someone have experienced my problem?
--
Diego Guidi

Diego Guidi ha scritto:

I'm experiencing some troubles using GeoServer as WMS, so I need some suggests.
I'm using OpenLayers to show a single wms layer that is composed from
multiple GeoServer WMS layers; this means that when i click on my
objects I make a WMS GetFeatureInfo call with this parameters:
LAYERS=LAYER1,LAYER2,LAYER3&QUERYLAYERS=LAYER1,LAYER2,LAYER3.
I'm expecting that geoserver parses all layers for one or more
features, but I'm experiencing that only the first layer is called for
getfeatureinfo.
This means that in the query shown earlier, if i click on an object of
LAYER2, the feature is not retrieved, but if I hide LAYER1, so LAYER2
is the first layer in the query, I could retrieve feature information.
Someone have experienced my problem?

I think GeoServer is behaving like the specification mandates. The GetFeatureInfo request has a feature_count parameter that is
used to control the number or returned features.
From the wms 1.1.1 spec, page 40:
"FEATURE_COUNT=number, optional, Number of features about which to return information (default=1)."
(see the full spec here: http://portal.opengeospatial.org/files/?artifact_id=1081&version=1&format=pdf)

So if you want to grab more features, you'll have to increase that
number. For example, if you load the tiger_ny sample layer group
and click on it, you'll get features from multiple layers because
the OL code is setup to use FEATURE_COUNT = 50.

Hope this helps
Cheers
Andrea

> This means that in the query shown earlier, if i click on an object of
> LAYER2, the feature is not retrieved, but if I hide LAYER1, so LAYER2
> is the first layer in the query, I could retrieve feature information.
> Someone have experienced my problem?

Thanks, I try monday and post the results :wink:

So if you want to grab more features, you'll have to increase that
number. For example, if you load the tiger_ny sample layer group
and click on it, you'll get features from multiple layers because
the OL code is setup to use FEATURE_COUNT = 50.

I've tried your suggest and looks OK using the openlayers code in the
geoserver samples.
Thanks.

I've tried your suggest and looks OK using the openlayers code in the
geoserver samples.

I've fixed the code in the openlayer sample from geoserver, but not im
by code :frowning:
This is a sample call make from working sample:
http://localhost:8080/geoserver/wms?LAYERS=FERROVIE%2CSTRADE%2CEDIFICI&STYLES=&HEIGHT=550&WIDTH=356&SRS=EPSG%3A32632&FORMAT=image%2Fpng&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetFeatureInfo&EXCEPTIONS=application%2Fvnd.ogc.se_xml&BBOX=506480.631578%2C4404173.889293%2C506875.808248%2C4404784.415047&X=159&Y=220&INFO_FORMAT=text%2Fhtml&QUERY_LAYERS=FERROVIE%2CSTRADE%2CEDIFICI&FEATURE_COUNT=50&layers=FERROVIE%2CSTRADE%2CEDIFICI&styles=&srs=EPSG%3A32632
this call works well.
This call is from my code:
http://localhost:8080/geoserver/wms?LAYERS=FERROVIE%2CSTRADE%2CEDIFICI&VERSION=1.1.1&STYLES=&SRS=EPSG%3A900913&FORMAT=image%2Fgif&TRANSPARENT=true&TILED=false&SERVICE=WMS&REQUEST=GetFeatureInfo&EXCEPTIONS=application%2Fvnd.ogc.se_xml&BBOX=1010855.81236%2C4751421.223831%2C1018853.036442%2C4756045.664041&X=315&Y=371&INFO_FORMAT=text%2Fplain&QUERY_LAYERS=FERROVIE%2CSTRADE%2CEDIFICI&FEATURE_COUNT=50&styles=&srs=EPSG%3A900913&WIDTH=837&HEIGHT=484
and not works.
The only change i see is the EPSG that is 900913 (google projection) n
my code and 3263 (real projection data) in working sample.
In my code the reprojection is well done using getmap (see attached
for sample calls).
Any suggestion?

test.txt (1.27 KB)

Diego Guidi ha scritto:

I've tried your suggest and looks OK using the openlayers code in
the geoserver samples.

I've fixed the code in the openlayer sample from geoserver, but not
im by code :frowning: This is a sample call make from working sample: http://localhost:8080/geoserver/wms?LAYERS=FERROVIE%2CSTRADE%2CEDIFICI&STYLES=&HEIGHT=550&WIDTH=356&SRS=EPSG%3A32632&FORMAT=image%2Fpng&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetFeatureInfo&EXCEPTIONS=application%2Fvnd.ogc.se_xml&BBOX=506480.631578%2C4404173.889293%2C506875.808248%2C4404784.415047&X=159&Y=220&INFO_FORMAT=text%2Fhtml&QUERY_LAYERS=FERROVIE%2CSTRADE%2CEDIFICI&FEATURE_COUNT=50&layers=FERROVIE%2CSTRADE%2CEDIFICI&styles=&srs=EPSG%3A32632
this call works well. This call is from my code: http://localhost:8080/geoserver/wms?LAYERS=FERROVIE%2CSTRADE%2CEDIFICI&VERSION=1.1.1&STYLES=&SRS=EPSG%3A900913&FORMAT=image%2Fgif&TRANSPARENT=true&TILED=false&SERVICE=WMS&REQUEST=GetFeatureInfo&EXCEPTIONS=application%2Fvnd.ogc.se_xml&BBOX=1010855.81236%2C4751421.223831%2C1018853.036442%2C4756045.664041&X=315&Y=371&INFO_FORMAT=text%2Fplain&QUERY_LAYERS=FERROVIE%2CSTRADE%2CEDIFICI&FEATURE_COUNT=50&styles=&srs=EPSG%3A900913&WIDTH=837&HEIGHT=484
and not works. The only change i see is the EPSG that is 900913
(google projection) n my code and 3263 (real projection data) in
working sample. In my code the reprojection is well done using getmap
(see attached for sample calls). Any suggestion?

Hum, I made a couple of tests. If I use the states shapefile as is
and then issue a GetFeatureInfo in 900913 it works. For example, try:
http://localhost:8080/geoserver/wms?bbox=-1.4206537827649849E7,2696945.284545485,-7133550.0444934955,6511565.902005815&styles=&Format=application/openlayers&request=GetMap&layers=topp:states&width=800&height=404&srs=EPSG:900913
and then click on the map.

Yet, if in the states shapefile feature type I change the srs to 900913
and change srs handling to reproject (to make the feature type appear
as if it was natively in 900913) then it does not work.

The latter usage is not recommended, data should stay in its native
srs and be reprojected on the fly during requests instead (we can
reproject WFS as well, even if it's 1.0, we backported that capability
from WFS 1.1).
Yet it's a bug indeed, I've opened a jira issue to fix it:
http://jira.codehaus.org/browse/GEOS-1752

Cheers
Andrea

The latter usage is not recommended, data should stay in its native
srs and be reprojected on the fly during requests instead (we can
reproject WFS as well, even if it's 1.0, we backported that capability
from WFS 1.1).

My data is not configured in 900313 but in 32632, so I suppose that is
reprojected onthefly.
So In my case the code should work.
Maybe this bug don't solve my problem, I suppose.

Diego Guidi ha scritto:

The latter usage is not recommended, data should stay in its native
srs and be reprojected on the fly during requests instead (we can
reproject WFS as well, even if it's 1.0, we backported that capability
from WFS 1.1).

My data is not configured in 900313 but in 32632, so I suppose that is
reprojected onthefly.

It depends... what is the srs handling you're using?

So In my case the code should work.
Maybe this bug don't solve my problem, I suppose.

Hum, I've made a test with one of the layers you sent me and ...
it works for me.
Here is the request you have to make to see ST01TE02CL02 in
900913 and GetFeatureInfo works for me there:
http://localhost:8080/geoserver/wms?bbox=925066.7424497926,4730805.470527659,1082096.6132188565,5039868.660113679&styles=&Format=application/openlayers&request=GetMap&layers=topp:ST01TE02CL02&width=350&height=550&srs=EPSG:900913

Maybe the problem lies in your javascript?
Cheers
Andrea