deegree / deegree3

Official deegree repository providing geospatial core libraries, data access and advanced OGC web service implementations
https://www.deegree.org
GNU Lesser General Public License v2.1
146 stars 99 forks source link

Reprojection from EPSG:3857 to EPSG:31468 #1518

Open Kate-Lyndegaard opened 1 year ago

Kate-Lyndegaard commented 1 year ago

Hi,

We are currently seeing that source data in EPSG:3857 is shifted approximately 20 KM north when reprojected to EPSG:31468 in deegree version 3.4.17.

Reproduction: Request data from this WFS in EPSG:31468 and view it in QGIS against the same data in EPSG:3857.

I would like to fix the issue, and as a starting point I am wondering why the InverseFlattening value of the google_maps_sphere (ellipsoid) is 0 and not 298.257223563? This value can be viewed in line 337 in: https://github.com/deegree/deegree3/blob/main/deegree-core/deegree-core-cs/src/main/resources/org/deegree/cs/persistence/deegree/d3/config/ellipsoid-definitions.xml.

The value 298.257223563 is commented out. This value is used in the 3857 definition in the EPSG database: https://epsg.org/crs_3857/WGS-84-Pseudo-Mercator.html. I can also see that it's used in the WKT used by QGIS, where I can reproject the data from EPSG:3857 to EPSG:31468 without issue.

I will try publishing data in 3857 and then requesting in 31468 using the InverseFlattening of 298.257223563 and see if that fixes the problem.

tfr42 commented 1 year ago

Thank you for your feedback and the effort you put in the investigation. Can you tell us, if this behaviour is still present in the latest versions of deegree webservices 3.4/3.5?

tfr42 commented 1 year ago

Related commit: https://github.com/deegree/deegree3/commit/e5c09b41e258a96aa23f3cddea3b83406cbb7e6b

Kate-Lyndegaard commented 1 year ago

Hi @tfr42 ,

Yes, it appears in 3.5. I am still testing this issue and will respond as soon as I have more information.

Kate-Lyndegaard commented 1 year ago

Hi,

I have been digging into the code and it appears that deegree performs a series of transformations from EPSG:3857 to EPSG:4978 to EPSG:4314 to EPSG:31468.

Do you know where EPSG:4978 is defined in the deegree project? I can't find it.

In a unit test which tests the transformation from EPSG:3857 to EPSG:4314, the result already displays 20 KM north so I would like to try to narrow down the source of error further.