Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fix failing test "test_crs()" with GDAL 3.4 #257

Closed
caspervdw opened this issue Sep 20, 2022 · 3 comments
Closed

Fix failing test "test_crs()" with GDAL 3.4 #257

caspervdw opened this issue Sep 20, 2022 · 3 comments
Labels
bug Something isn't working

Comments

@caspervdw
Copy link
Collaborator

On Ubuntu 22, we have GDAL 3.4. This makes a test fail having to do with CRS:

./threedigrid_builder/tests/test_raster_interfaces.py::test_crs Failed: [undefined]assert <Derived Projected CRS: EPSG:28992>\nName: Amersfoort / RD New\nAxis Info [cartesian]:\n- [east]: Easting (metre)\n- [nort...- name: unnamed\n- method: Oblique Stereographic\nDatum: Amersfoort\n- Ellipsoid: Bessel 1841\n- Prime Meridian: Greenwich\n == <Bound CRS: PROJCS["Amersfoort / RD New",GEOGCS["Amersfoort",D ...>\nName: Amersfoort / RD New\nAxis Info [cartesian]:\n-...(geog2D domain)\nDatum: Amersfoort\n- Ellipsoid: Bessel 1841\n- Prime Meridian: Greenwich\nSource CRS: Amersfoort / RD New\n
 +  where <Derived Projected CRS: EPSG:28992>\nName: Amersfoort / RD New\nAxis Info [cartesian]:\n- [east]: Easting (metre)\n- [nort...- name: unnamed\n- method: Oblique Stereographic\nDatum: Amersfoort\n- Ellipsoid: Bessel 1841\n- Prime Meridian: Greenwich\n = <GDALInterface of file /home/casper/code/threedigrid-builder/threedigrid_builder/tests/data/dem_test_5m.tif>.crs
dem_path = PosixPath('/home/casper/code/threedigrid-builder/threedigrid_builder/tests/data/dem_test_5m.tif')
crs_wkt_28992_legacy = <Bound CRS: PROJCS["Amersfoort / RD New",GEOGCS["Amersfoort",D ...>
Name: Amersfoort / RD New
Axis Info [cartesian]:
-...(geog2D domain)
Datum: Amersfoort
- Ellipsoid: Bessel 1841
- Prime Meridian: Greenwich
Source CRS: Amersfoort / RD New


    def test_crs(dem_path, crs_wkt_28992_legacy):
        with GDALInterface(dem_path) as dem:
>           assert dem.crs == crs_wkt_28992_legacy
E           assert <Derived Projected CRS: EPSG:28992>\nName: Amersfoort / RD New\nAxis Info [cartesian]:\n- [east]: Easting (metre)\n- [nort...- name: unnamed\n- method: Oblique Stereographic\nDatum: Amersfoort\n- Ellipsoid: Bessel 1841\n- Prime Meridian: Greenwich\n == <Bound CRS: PROJCS["Amersfoort / RD New",GEOGCS["Amersfoort",D ...>\nName: Amersfoort / RD New\nAxis Info [cartesian]:\n-...(geog2D domain)\nDatum: Amersfoort\n- Ellipsoid: Bessel 1841\n- Prime Meridian: Greenwich\nSource CRS: Amersfoort / RD New\n
E            +  where <Derived Projected CRS: EPSG:28992>\nName: Amersfoort / RD New\nAxis Info [cartesian]:\n- [east]: Easting (metre)\n- [nort...- name: unnamed\n- method: Oblique Stereographic\nDatum: Amersfoort\n- Ellipsoid: Bessel 1841\n- Prime Meridian: Greenwich\n = <GDALInterface of file /home/casper/code/threedigrid-builder/threedigrid_builder/tests/data/dem_test_5m.tif>.crs

threedigrid_builder/tests/test_raster_interfaces.py:15: AssertionError

There is indeed a difference in the WKTs the two CRSes are constructed from. The new GDAL has no "TOWGS84" element.

>> dem.crs.srs  # GDAL 3.4
'PROJCS["Amersfoort / RD New",GEOGCS["Amersfoort",DATUM["Amersfoort",SPHEROID["Bessel 1841",6377397.155,299.1528128,AUTHORITY["EPSG","7004"]],AUTHORITY["EPSG","6289"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4289"]],PROJECTION["Oblique_Stereographic"],PARAMETER["latitude_of_origin",52.1561605555556],PARAMETER["central_meridian",5.38763888888889],PARAMETER["scale_factor",0.9999079],PARAMETER["false_easting",155000],PARAMETER["false_northing",463000],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AXIS["Easting",EAST],AXIS["Northing",NORTH],AUTHORITY["EPSG","28992"]]'
>> crs_wkt_28992_legacy.srs  # GDAL 3.0 (expected value)
'PROJCS["Amersfoort / RD New",GEOGCS["Amersfoort",DATUM["Amersfoort",SPHEROID["Bessel 1841",6377397.155,299.1528128,AUTHORITY["EPSG","7004"]],TOWGS84[565.2369,50.0087,465.658,-0.406857,0.350733,-1.87035,4.0812],AUTHORITY["EPSG","6289"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4289"]],PROJECTION["Oblique_Stereographic"],PARAMETER["latitude_of_origin",52.1561605555556],PARAMETER["central_meridian",5.38763888888889],PARAMETER["scale_factor",0.9999079],PARAMETER["false_easting",155000],PARAMETER["false_northing",463000],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AXIS["Easting",EAST],AXIS["Northing",NORTH],AUTHORITY["EPSG","28992"]]'
@caspervdw caspervdw added the bug Something isn't working label Sep 20, 2022
@elisalle elisalle self-assigned this Mar 15, 2023
@elisalle elisalle removed their assignment May 8, 2023
@leendertvanwolfswinkel leendertvanwolfswinkel changed the title Failing test with GDAL 3.4 Fix failing test "test_crs()" with GDAL 3.4 Feb 5, 2024
@jpprins1
Copy link
Contributor

jpprins1 commented Feb 13, 2024

@leendertvanwolfswinkel: heb jij een idee wat de impact is van de veranderde SRS?

@leendertvanwolfswinkel
Copy link
Collaborator

Ik heb geen idee, het lijkt me niet echt een probleem eigenlijk. Er zal een reden zijn dat GDAL dit eruit gesloopt heeft, i.e. dat het niet meer nodig is?

@daanvaningen
Copy link
Contributor

threedigrid-builder needs a release version for this and api still points to 1.12.2

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants