Coordinates outside bounds of area of use now return inf
See original GitHub issueRunning the GeoPandas tests with proj 6 / pyproj master, turned up this regression:
In [1]: import pyproj
In [2]: pyproj.__version__
Out[2]: '2.1.3'
In [3]: p1 = pyproj.Proj(init='epsg:26918')
...: p2 = pyproj.Proj(init='epsg:4326')
In [4]: pyproj.transform(p1, p2, 0, 0)
Out[4]: (inf, inf)
vs
In [1]: import pyproj
In [2]: pyproj.__version__
Out[2]: '1.9.6'
In [3]: p1 = pyproj.Proj(init='epsg:26918')
...: p2 = pyproj.Proj(init='epsg:4326')
In [4]: pyproj.transform(p1, p2, 0, 0)
Out[4]: (-79.48874388438705, 0.0)
So the transform now returns inf
instead of an actual value. The coordinates however are out of the area of use (see bounds here http://epsg.io/26918). But previously it did calculate the transformed values nevertheless.
Here, it was a dummy test case in geopandas where we did not check that the tested dummy values were actually properly inside the bounds of the tested CRS. So that is easy to edit. But, it still is a breaking change (I don’t know that what extent people run into this in practice).
This seems a bit similar to https://github.com/pyproj4/pyproj/issues/202, but the difference is that here pyproj 1.9.6 actually returned values and not inf.
Issue Analytics
- State:
- Created 4 years ago
- Comments:15 (12 by maintainers)
Top Results From Across the Web
The feature geometry could not be modified. The coordinates ...
Technical Article Details : Error: The feature geometry could not be modified. The coordinates or measures are out of bounds.
Read more >Pyproj returns inf when coordinates are inside bounds
I'm trying to parse the data from GHSL-POP, converting coordinates to real-world latitudes and longitudes. But pyproj returns inf value for ...
Read more >Finding Area Bounded By Two Polar Curves - YouTube
This calculus 2 video tutorial explains how to find the area ... how to find the area that lies inside the first curve...
Read more >Finding Area In Polar Coordinates - YouTube
This Calculus 2 video tutorial explains how to find the area of a polar curve in polar coordinates. It provides resources on how...
Read more >How to raise an error that coordinates are out of raster bounds ...
Rasterio sample module gives back value 0 in case like that, but that is not good (because if raster image has values 0-255)...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@yxdragon, the good news is that there is a simple solution to your problem. In PROJ 6+, they take the axis order into consideration when doing transformations.
In your case,
wkt1
has the latitude first longitude second andwkt2
has the east first and the northing second:Since this is the case, you need to swap the order of your input so that the latitude is first and longitude is second:
Or, if you want it to always have the longitude first and latitude second, you can toggle on the
always_xy
argument:For more information about this, I would recommend looking at:
Hopefully this helps.
It would be useful to have in another issue so it is easier for someone who has a similar question. I would recommend looking into
Transformer.from_pipeline()
.