[Geoserver-devel] [JIRA] (GEOS-10911) WFS getFeature does double reprojection if other SRS is set

Martin Raie created an issue

GeoServer / BugGEOS-10911

WFS getFeature does double reprojection if other SRS is set

Issue Type:

BugBug

Assignee:

Unassigned

Created:

27/Mar/23 6:04 PM

Priority:

MediumMedium

Reporter:

Martin Raie

If remote WFS service has features which define OtherSRS and if such layer CRS is configured as “Reproject native to declared” in Geoserver then Geoserver does reprojection twice when making getFeature request.

To reproduce the issue, add following url as Web Feature Server (NG) store: https://teenus.maaamet.ee/ows/gpa?service=WFS and configure layer “ms_kohalik_vork”, setting native SRS: EPSG:3301, declared SRS: EPSG:3857, SRS handling: “Reproject native to declared”.

When making query http://geoserver/geoserver/workspace/wfs?SERVICE=WFS&VERSION=1.3.0&REQUEST=GetFeature&typeName=workspace:ms_kohalik_vork&PROPERTYNAME=msGeometry&FEATUREID=kohalik_vork.33056 the result coordinates are following:

<gml:pos>8737543.97761727 578481.77163451</gml:pos>

The original coordinates from the service https://teenus.maaamet.ee/ows/gpa?PROPERTYNAME=msGeometry&REQUEST=GetFeature&FEATUREID=kohalik_vork.33056&VERSION=2.0.0&TYPENAMES=ms%3Akohalik_vork&SERVICE=WFS in EPSG:3301 are

<gml:pos>6562201.382000 714182.960000</gml:pos>

When converting 6562201.382000 714182.960000 in EPSG:3301 to EPSG:3857 the expected result should have been

<gml:pos>3088480.32010006 8211704.47330954</gml:pos>

The result 8737543.97761727 578481.77163451 can be achieved when doing EPSG:3301->EPSG:3857 conversion twice.

When using some similar WFS service which doesn’t define OtherSRS then results are correct.

I believe the problem is using both ReprojectFeatureResults and ReprojectFeatureReader classes. If OtherSRS is not set, following row in code sets coordinateSystem null and everything works correctly:

https://github.com/geoserver/geoserver/blob/main/src/main/src/main/java/org/vfny/geoserver/global/GeoServerFeatureSource.java#L584

If OtherSRS is set and coordinateSystem is not null then code reaches here:

https://github.com/geotools/geotools/blob/ea553f72c8b02b4c0075fa454fce04891d881ded/modules/unsupported/wfs-ng/src/main/java/org/geotools/data/wfs/WFSFeatureSource.java#L356

and second reprojection is done with ReprojectFeatureReader.

Add Comment

Add Comment

Get Jira notifications on your phone! Download the Jira Cloud app for Android or iOS


This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100219-sha1:ac3e918)

Atlassian logo