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.

Add deprecation warning for +init= syntax

See original GitHub issue

From: https://gitter.im/pyproj4-pyproj/community?at=5d13c274b3f22a4b2a4018be

More info about deprecation: https://github.com/pyproj4/pyproj/issues/224#issuecomment-476647824

It probably would be a good idea to add a deprecation warning when users use the +init= syntax.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:15 (13 by maintainers)

github_iconTop GitHub Comments

3reactions
snowman2commented, Jul 3, 2019

This is the scenario I am concerned about:

A user creates or loads in the GeoDataFrame

>>> from shapely.geometry import Point
>>> import geopandas
>>> gsr = geopandas.GeoSeries([Point(12, 51)], crs={"init": "epsg:4326"})
>>> gsr.crs
{'init': 'epsg:4326'}

Then the user decides to re-project the data and gets the deprecation warning

>>> gsr.to_crs("epsg:3857")
/home/snowal/scripts/pyproj/pyproj/crs.py:114: ProjDeprecationWarning: '+init=<authority>:<code>' syntax is deprecated. '<authority>:<code>' is the preferred initialization method.
  ProjDeprecationWarning,
0    POINT (1335833.889519283 6621293.722740169)
dtype: object

So, because this is deprecated, the user is going to switch to the new syntax

>>> gsr = geopandas.GeoSeries([Point(12, 51)], crs="epsg:4326")
>>> gsr.to_crs("epsg:3857")
0    POINT (5677294.030456952 1345708.408409109)
dtype: object

And the input axis order is swapped, so their reprojected data is now incorrect. They may or may not realize this and move along with incorrectly re-projected data.

2reactions
Sieboldianuscommented, Jan 24, 2020

This is the scenario I am concerned about:

A user creates or loads in the GeoDataFrame

>>> from shapely.geometry import Point
>>> import geopandas
>>> gsr = geopandas.GeoSeries([Point(12, 51)], crs={"init": "epsg:4326"})
>>> gsr.crs
{'init': 'epsg:4326'}

Then the user decides to re-project the data and gets the deprecation warning

>>> gsr.to_crs("epsg:3857")
/home/snowal/scripts/pyproj/pyproj/crs.py:114: ProjDeprecationWarning: '+init=<authority>:<code>' syntax is deprecated. '<authority>:<code>' is the preferred initialization method.
  ProjDeprecationWarning,
0    POINT (1335833.889519283 6621293.722740169)
dtype: object

So, because this is deprecated, the user is going to switch to the new syntax

>>> gsr = geopandas.GeoSeries([Point(12, 51)], crs="epsg:4326")
>>> gsr.to_crs("epsg:3857")
0    POINT (5677294.030456952 1345708.408409109)
dtype: object

And the input axis order is swapped, so their reprojected data is now incorrect. They may or may not realize this and move along with incorrectly re-projected data.

Haha… one year later, that was exactly what caused me 6+ hours of headache. It was not related to Geopandas, rather standard use of pyproj in a separate package. Saw the depreciation notice, switched to recommended syntax: projected geometries had switched (wrong) axis because I was using the traditional style of coordinate-order (lng, lat)… too bad I didn’t see your comment a couple of hours earlier!

Read more comments on GitHub >

github_iconTop Results From Across the Web

pyproj FutureWarning: '+init=<authority>:<code>' syntax is ...
pyproj FutureWarning: '+init=<authority>:<code>' syntax is deprecated ; Open Street Map (pyproj). How to solve syntax issue? has a similar ...
Read more >
Python deprecation - DEV Community ‍ ‍
To warn about deprecation, you need to set Python's builtin DeprecationWarning as category. To let the warning refer to the caller, so you...
Read more >
Warning: expression closures are deprecated - MDN Web Docs
The JavaScript warning "expression closures are deprecated" occurs when the non-standard expression closure syntax (shorthand function syntax) ...
Read more >
C++ attribute: deprecated (since C++14) - cppreference.com
Indicates that the name or entity declared with this attribute is deprecated, that is, the use is allowed, but discouraged for some reason....
Read more >
How to deprecate classes, methods, arguments and hooks in ...
Add a @deprecated annotation to the class doc comment · Deprecate the constructor - see next section about deprecating a method ...
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