question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

BUG: UTM CRS estimation fails with Proj 8.1

See original GitHub issue
  • I have checked that this issue has not already been reported.
  • I have confirmed this bug exists on the latest version of geopandas.
  • (optional) I have confirmed this bug exists on the master branch of geopandas.

Problem description

Running tests of 0.9.0 with Proj 8.1.0 fails on the following tests:

=================================== FAILURES ===================================
_____________ TestEstimateUtmCrs.test_estimate_utm_crs__geographic _____________

self = <geopandas.tests.test_array.TestEstimateUtmCrs object at 0x7fa47fe65840>

    def test_estimate_utm_crs__geographic(self):
        if compat.PYPROJ_LT_3:
            with pytest.raises(RuntimeError, match=r"pyproj 3\+ required"):
                self.landmarks.estimate_utm_crs()
        else:
            assert self.landmarks.estimate_utm_crs() == CRS("EPSG:32618")
>           assert self.landmarks.estimate_utm_crs("NAD83") == CRS("EPSG:26918")
E           AssertionError: assert <Projected CRS: EPSG:3725>\nName: NAD83(NSRS2007) / UTM zone 18N\nAxis Info [cartesian]:\n- E[east]: Easting (metre)\n- N[...verse Mercator\nDatum: NAD83 (National Spatial Reference System 2007)\n- Ellipsoid: GRS 1980\n- Prime Meridian: Greenwich\n == <Projected CRS: EPSG:26918>\nName: NAD83 / UTM zone 18N\nAxis Info [cartesian]:\n- E[east]: Easting (metre)\n- N[north]: N...e 18N\n- method: Transverse Mercator\nDatum: North American Datum 1983\n- Ellipsoid: GRS 1980\n- Prime Meridian: Greenwich\n
E            +  where <Projected CRS: EPSG:3725>\nName: NAD83(NSRS2007) / UTM zone 18N\nAxis Info [cartesian]:\n- E[east]: Easting (metre)\n- N[...verse Mercator\nDatum: NAD83 (National Spatial Reference System 2007)\n- Ellipsoid: GRS 1980\n- Prime Meridian: Greenwich\n = <bound method GeometryArray.estimate_utm_crs of <GeometryArray>\n[<shapely.geometry.point.Point object at 0x7fa47fed0100>, <shapely.geometry.point.Point object at 0x7fa47ff36080>]\nLength: 2, dtype: geometry>('NAD83')
E            +    where <bound method GeometryArray.estimate_utm_crs of <GeometryArray>\n[<shapely.geometry.point.Point object at 0x7fa47fed0100>, <shapely.geometry.point.Point object at 0x7fa47ff36080>]\nLength: 2, dtype: geometry> = <GeometryArray>\n[<shapely.geometry.point.Point object at 0x7fa47fed0100>, <shapely.geometry.point.Point object at 0x7fa47ff36080>]\nLength: 2, dtype: geometry.estimate_utm_crs
E            +      where <GeometryArray>\n[<shapely.geometry.point.Point object at 0x7fa47fed0100>, <shapely.geometry.point.Point object at 0x7fa47ff36080>]\nLength: 2, dtype: geometry = <geopandas.tests.test_array.TestEstimateUtmCrs object at 0x7fa47fe65840>.landmarks
E            +  and   <Projected CRS: EPSG:26918>\nName: NAD83 / UTM zone 18N\nAxis Info [cartesian]:\n- E[east]: Easting (metre)\n- N[north]: N...e 18N\n- method: Transverse Mercator\nDatum: North American Datum 1983\n- Ellipsoid: GRS 1980\n- Prime Meridian: Greenwich\n = CRS('EPSG:26918')

geopandas/tests/test_array.py:918: AssertionError
_____________________ TestDataFrame.test_estimate_utm_crs ______________________

self = <geopandas.tests.test_geodataframe.TestDataFrame object at 0x7fa47f701180>

    def test_estimate_utm_crs(self):
        if PYPROJ_LT_3:
            with pytest.raises(RuntimeError, match=r"pyproj 3\+ required"):
                self.df.estimate_utm_crs()
        else:
            assert self.df.estimate_utm_crs() == CRS("EPSG:32618")
>           assert self.df.estimate_utm_crs("NAD83") == CRS("EPSG:26918")
E           AssertionError: assert <Projected CRS: EPSG:3725>\nName: NAD83(NSRS2007) / UTM zone 18N\nAxis Info [cartesian]:\n- E[east]: Easting (metre)\n- N[...verse Mercator\nDatum: NAD83 (National Spatial Reference System 2007)\n- Ellipsoid: GRS 1980\n- Prime Meridian: Greenwich\n == <Projected CRS: EPSG:26918>\nName: NAD83 / UTM zone 18N\nAxis Info [cartesian]:\n- E[east]: Easting (metre)\n- N[north]: N...e 18N\n- method: Transverse Mercator\nDatum: North American Datum 1983\n- Ellipsoid: GRS 1980\n- Prime Meridian: Greenwich\n
E            +  where <Projected CRS: EPSG:3725>\nName: NAD83(NSRS2007) / UTM zone 18N\nAxis Info [cartesian]:\n- E[east]: Easting (metre)\n- N[...verse Mercator\nDatum: NAD83 (National Spatial Reference System 2007)\n- Ellipsoid: GRS 1980\n- Prime Meridian: Greenwich\n = <bound method GeoDataFrame.estimate_utm_crs of    BoroCode  ...                                           geometry\n0  ...9.056 188655.316, 980940....\n4         2  ...  MULTIPOLYGON (((1012821.806 229228.265, 101278...\n\n[5 rows x 5 columns]>('NAD83')
E            +    where <bound method GeoDataFrame.estimate_utm_crs of    BoroCode  ...                                           geometry\n0  ...9.056 188655.316, 980940....\n4         2  ...  MULTIPOLYGON (((1012821.806 229228.265, 101278...\n\n[5 rows x 5 columns]> =    BoroCode  ...                                           geometry\n0         5  ...  MULTIPOLYGON (((970217.022 14564...19.056 188655.316, 980940....\n4         2  ...  MULTIPOLYGON (((1012821.806 229228.265, 101278...\n\n[5 rows x 5 columns].estimate_utm_crs
E            +      where    BoroCode  ...                                           geometry\n0         5  ...  MULTIPOLYGON (((970217.022 14564...19.056 188655.316, 980940....\n4         2  ...  MULTIPOLYGON (((1012821.806 229228.265, 101278...\n\n[5 rows x 5 columns] = <geopandas.tests.test_geodataframe.TestDataFrame object at 0x7fa47f701180>.df
E            +  and   <Projected CRS: EPSG:26918>\nName: NAD83 / UTM zone 18N\nAxis Info [cartesian]:\n- E[east]: Easting (metre)\n- N[north]: N...e 18N\n- method: Transverse Mercator\nDatum: North American Datum 1983\n- Ellipsoid: GRS 1980\n- Prime Meridian: Greenwich\n = CRS('EPSG:26918')

geopandas/tests/test_geodataframe.py:707: AssertionError
_________________ TestSeries.test_estimate_utm_crs__geographic _________________

self = <geopandas.tests.test_geoseries.TestSeries object at 0x7fa47ed4a530>

    def test_estimate_utm_crs__geographic(self):
        if PYPROJ_LT_3:
            with pytest.raises(RuntimeError, match=r"pyproj 3\+ required"):
                self.landmarks.estimate_utm_crs()
        else:
            assert self.landmarks.estimate_utm_crs() == CRS("EPSG:32618")
>           assert self.landmarks.estimate_utm_crs("NAD83") == CRS("EPSG:26918")
E           AssertionError: assert <Projected CRS: EPSG:3725>\nName: NAD83(NSRS2007) / UTM zone 18N\nAxis Info [cartesian]:\n- E[east]: Easting (metre)\n- N[...verse Mercator\nDatum: NAD83 (National Spatial Reference System 2007)\n- Ellipsoid: GRS 1980\n- Prime Meridian: Greenwich\n == <Projected CRS: EPSG:26918>\nName: NAD83 / UTM zone 18N\nAxis Info [cartesian]:\n- E[east]: Easting (metre)\n- N[north]: N...e 18N\n- method: Transverse Mercator\nDatum: North American Datum 1983\n- Ellipsoid: GRS 1980\n- Prime Meridian: Greenwich\n
E            +  where <Projected CRS: EPSG:3725>\nName: NAD83(NSRS2007) / UTM zone 18N\nAxis Info [cartesian]:\n- E[east]: Easting (metre)\n- N[...verse Mercator\nDatum: NAD83 (National Spatial Reference System 2007)\n- Ellipsoid: GRS 1980\n- Prime Meridian: Greenwich\n = <bound method GeoSeries.estimate_utm_crs of 0    POINT (-73.98470 40.74840)\n1    POINT (-74.04460 40.68930)\ndtype: geometry>('NAD83')
E            +    where <bound method GeoSeries.estimate_utm_crs of 0    POINT (-73.98470 40.74840)\n1    POINT (-74.04460 40.68930)\ndtype: geometry> = 0    POINT (-73.98470 40.74840)\n1    POINT (-74.04460 40.68930)\ndtype: geometry.estimate_utm_crs
E            +      where 0    POINT (-73.98470 40.74840)\n1    POINT (-74.04460 40.68930)\ndtype: geometry = <geopandas.tests.test_geoseries.TestSeries object at 0x7fa47ed4a530>.landmarks
E            +  and   <Projected CRS: EPSG:26918>\nName: NAD83 / UTM zone 18N\nAxis Info [cartesian]:\n- E[east]: Easting (metre)\n- N[north]: N...e 18N\n- method: Transverse Mercator\nDatum: North American Datum 1983\n- Ellipsoid: GRS 1980\n- Prime Meridian: Greenwich\n = CRS('EPSG:26918')

geopandas/tests/test_geoseries.py:212: AssertionError

Output of geopandas.show_versions()

SYSTEM INFO

python : 3.10.0b4 (default, Jul 23 2021, 00:00:00) [GCC 11.1.1 20210623 (Red Hat 11.1.1-6)] executable : /usr/bin/python3 machine : Linux-5.12.11-300.fc34.x86_64-x86_64-with-glibc2.33.9000

GEOS, GDAL, PROJ INFO

GEOS : None GEOS lib : None GDAL : 3.3.1 GDAL data dir: /usr/share/gdal PROJ : 8.1.0 PROJ data dir: /usr/share/proj

PYTHON DEPENDENCIES

geopandas : 0.9.0 pandas : 1.3.0 fiona : 1.8.20 numpy : 1.20.1 shapely : 1.7.1 rtree : 0.9.4 pyproj : 3.1.0 matplotlib : 3.4.2 mapclassify: None geopy : None psycopg2 : None geoalchemy2: None pyarrow : None pygeos : None

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:10 (10 by maintainers)

github_iconTop GitHub Comments

2reactions
snowman2commented, Aug 26, 2021

I guess that we can close this as fixed in upstream?

The next release of pyproj will come soon after the next release of PROJ at the beginning of September.

0reactions
QuLogiccommented, Sep 13, 2021

So that’s out and the test is working again, so I guess we can close this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

News — PROJ 9.1.1 documentation
Introduce PROJ_DATA` environment variable to deprecate PROJ_LIB (#3253). Bug fixes¶. projinfo: fix crash on –list-crs when proj.db cannot be opened ( ...
Read more >
PROJ coordinate transformation software library - GitHub
Geodetic/geographic CRS to Geodetic/geographic CRS, without known ... UTM: error out when value of +zone= is not an integer (#2672).
Read more >
[Bug] r.proj fails with global dataset exceeding 90N #2278
I can import into a WGS84 LongLat location (EPSG 4326) using r.in.gdal with no issue, but I cannot then reproject using r.proj into...
Read more >
Having problem with PROJ string for custom Coordinate System
But I want destination to be an actual custom coordinate system. So how do I derive it from that UTM CRS, given above...
Read more >
Managing Projections — GeoPandas 0.12.2+0.gefcb367.dirty ...
A CRS tells Python how those coordinates relate to places on the Earth. ... Conversions between WKT and PROJ strings will in most...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found