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:
geoserver settings

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.

  1. 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

  2. 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.

5 Answers 5


I am aware of the option to set the "declared SRS" when publishing a layer in Geoserver, [...] But is there a way to re-project the coordinates on-the-fly?

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.


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.


You can't do that! In the layer publishing page you have to set the data projection to match the projection your data is in (in this case epsg:4326) - to do on the fly reprojection you just need to change the SRS in your request.

I'm not sure however if demo.openplans.org supports 90913 as the capabilities file only lists 4326 for the States layer.

I'm also not sure that GetFeatureInfo supports reprojection. You might want to try using WFS 1.1 for this task if you really need the GML coordinates which is not really what getFeatureInfo was designed for.


I couldnt get GetFeatureInfo to reproject, so i'm not sure it is possible with that request. But you can do it with WFS and GetFeature request.

On our Geoserver we have one layer that is with following settings alt text http://img411.imageshack.us/img411/9395/wfsbf.jpg




<gml:pos>13.390277999999968 45.31972200000002</gml:pos>




<gml:pos>1490598.92854037 5671996.39529428</gml:pos>

For filtering you can look at this reference. I hope this will help you.


Just dug into this, and I don't believe there is any way in GeoServer to do exactly what you want. Looking at the WMS specification it offers no guidance as to what a WMS should do when GML is requested in an alternate SRS, though I agree that the proper behavior probably should be to reproject it. Putting that requirement in though would have made that spec a lot more difficult to implement. I'm pretty sure being able to get GML from a WMS was a bit of an afterthought for the spec authors.

What OGC did to handle real GML requests was make the Web Feature Service specification. And they didn't even get to handling reprojection well until version 1.1 of the spec. So a less than ideal answer to your question is to use WFS, as it will certainly handle what you want. The downside is you have to manually transform your x,y screen coordinates to the proper bounding box, though most existing client software can do that.

You can go ahead and report the issue, as I think most geoserver devs would agree that even though the spec doesn't say anything about it what you want should be the right behavior. And should be relatively easy to implement, as all the mechanisms for reprojection are there. But it may not get fixed, since most everyone who wants GML uses WFS, as it's superior in every way except for not having the shortcut of x,y screen coordinates.


Unless I'm misunderstanding your question, reprojecting on the fly should be a simple matter of just specifying your desired output SRS in your WMS request string.

  • I have updated the question
    – taudorf
    Commented Aug 9, 2010 at 14:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.