I am using Geoserver to get featureinfo, but sometimes I want to re-project the native SRS in the output gml.
The request is a (WMS) "GetFeatureInfo" with INFO_FORMAT: application/vnd.ogc.gml.
I am aware of the option to set the "declared SRS" when publishing a layer in Geoserver, see below:
But is there a way to re-project the coordinates on-the-fly?
EDIT: Below is two diffrent WMS GetFeatureInfo requests that shows the problem. The first request has Srs=EPSG:4326 and bbox in the same srs and the second request has in Srs=EPSG:900913 and the bbox in in the same srs.
-
http://demo.opengeo.org/geoserver/wms?REQUEST=GetFeatureInfo&EXCEPTIONS=application/vnd.ogc.se_xml
&BBOX=-139.848137,18.549615,51.852863,55.778385&X=351&Y=193
&INFO_FORMAT=application/vnd.ogc.gml&QUERY_LAYERS=topp:states
&FEATURE_COUNT=50&Layers=topp:states&Styles=&Srs=EPSG:4326
&WIDTH=780&HEIGHT=330&format=image/png -
http://demo.opengeo.org/geoserver/wms?REQUEST=GetFeatureInfo&EXCEPTIONS=application/vnd.ogc.se_xml
&BBOX=-15567823.399227962,2101981.4669995294,5772234.305333375,7514424.280422591
&X=352&Y=220&INFO_FORMAT=application/vnd.ogc.gml&QUERY_LAYERS=topp:states
&FEATURE_COUNT=50&Layers=topp:states&Styles=&Srs=EPSG:900913
&WIDTH=780&HEIGHT=330&format=image/png
Both requests return the same gml with coordinates in EPSG:4326. I would expect the second request to have coordinates in EPSG:900913. As mentioned I can set the "declared SRS" in Geoserver, but what if I want to get the gml in another srs then the one declared. By on-the-fly I meant: Ask in one srs get the coordinates in the same srs without setting the declared srs. I hope that the question in more clear now.
Best Answer
That's exactly how you enable on-the-fly reprojection.
Reprojection that's not "on-the-fly" would mean that you have to upload the layer in the correct/final CRS.
Update:
GetFeatureInfo() was not designed to retrieve the vector geometry of objects. It will only return the original data (geometry and attributes). If you need reprojected vector geometries, you'll have to use a WFS.