Hi,
This is a rather long message but I hope it entertains some people even I am not sure if it can be used for anything useful. However, this is a trick originally discovered by a new Mapserver user who did not bother to read too much documents or standards.
The steps in the trick are these:
- Make both WIDTH and HEIGHTH in the GetFeatureInfo request into 1
- Use always X=1 and Y=1
So far everything is totally controlled and GetFeatureInfo is made with the only pixel we have. After this I am not so sure about who has the control.
- Make a very little BBOX
In the following example the BBOX corners are
-105.022856,42.47970388 and
-105.022855,42.47970389
Only the last digit of both coordinates is increased by one. Mapserver has a nice bug here which makes the use of the trick pretty simple because it accepts same coordinates for both corners of a BBOX. This makes affectively BBOX into a point!. Geoserver does not accept this but gives an error
Internal error occurred
Points of LinearRing do not form a closed linestring
</ServiceException></ServiceExceptionReport>
This error comes also if the corners are very little different, for example with this BBOX
BBOX=-105.02285686876569,42.47970388741691,-105.02285686876568,42.47970388741692&
That's probably due to internal accuracy in calculations.
So finally here is a full GetFeatureInfo request that should work against all Geoserver standard installations and find Wyoming
http://localhost:8080/geoserver/wms?
REQUEST=GetFeatureInfo&
SERVICE=WMS&
VERSION=1.1.1&
WIDTH=1&
HEIGHT=1&
LAYERS=topp:states&
QUERY_LAYERS=topp:states&
x=1&
y=1&
TRANSPARENT=TRUE&
FORMAT=image/png&
BBOX=-105.022856,42.47970388741691,-105.02285,42.47970388741692&
SRS=EPSG:4326&
STYLES=
I do not know what point Geoserver is quering when the BBOX is big. This request find Illinois even it is not even close to the BBOX
http://localhost:8080/geoserver/wms?
REQUEST=GetFeatureInfo&
SERVICE=WMS&
VERSION=1.1.1&
WIDTH=1&
HEIGHT=1&
LAYERS=topp%3Astates&
QUERY_LAYERS=topp%3Astates&
x=1&
y=1&
TRANSPARENT=TRUE&
FORMAT=image%2Fpng&
BBOX=-110.09376959353222,38.07638932483682,-105.05437741859839,41.95200030033059&
SRS=EPSG:4326&
STYLES=
I have a slight feeling that this relaxed GetFeatureInfo request could be useful for some purposes. For example a mobile client could capture GPS coordinates from the internal GPS receiver and insert that value into a prepared GetFeatureInfo request template and get back an answer to a question "What is here". WFS does that better but text/plain or text/html answer might suit better for the mobile client for showing the result. I have a strong feeling that it would not work in a reliable way with all the WMS server brands.
Regards,
-Jukka Rahkonen-
________________________________
Lähettäjä: Xavier Chaze [Xavier.Chaze@anonymised.com]
Lähetetty: 8. marraskuuta 2011 18:23
Vastaanottaja: geoserver-users@lists.sourceforge.net
Aihe: [Geoserver-users] WFS : Extract only attributes without geometry
Hello,
In fact, thanks to a URL containing point coordinates (Lon/Lat) we would like to extract attributes from a vector layer.
We have tested the WMS GetFeatureInfo. But in this case the URL has to be described thanks to images coordinates (in pixels) and we need to send through the URL the coordinates Longitude/Latitude.
And about the WFS GetFeatureIntersects, we obtained the geometry of the intersected feature (list of coordinates) and these information, unnecessary for us, risk to delay the response time.
So, is it possible, maybe to filter the response given by the WFS GetFeatureIntersects in order to recover the attributes only ?
We are also open for all other solutions.
Thanks a lot in advance for your answers.
Xavier