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.

would it be possible to have the CRS bounds in its original unit ?

See original GitHub issue

Let’s assume I want to get the bounds of the projection ‘EPSG:3857’ in meters (unit of the 3857 projection)

In the current implementation of pyproj and with my little knowledge I would do the following :

from pyproj import CRS, Transformer

in_crs = CRS.from_epsg(4326)
out_crs = CRS.from_epsg(3857)
x_min, y_min, x_max, y_max = out_crs.area_of_use.bounds

proj = Transformer.from_crs(4326, 3857, always_xy=True)
bl = proj.transform(x_min, y_min)
tr = proj.transform(x_max, y_max)

that’s a lot of steps just to extract the bounds in the original proj unit. Would it be possible to add a method to retrieve the projection in its original unit ?

I would be happy to PR this very code in PR if you agree with this way of computing it.

maybe I’m foolish and there is already a way to retrieve the bounds…

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
12rambaucommented, Apr 1, 2021

awesome ! thanks a lot

I have edited my answer on GIS.Stackexchange: https://gis.stackexchange.com/questions/390517/getting-projected-bounds-information-in-pyproj/392407#392407

let me know when it will be released !

1reaction
snowman2commented, Apr 1, 2021

How to get projected bounds with #810:

from pyproj import CRS, Transformer

crs = CRS("EPSG:3857")
transformer = Transformer.from_crs(crs.geodetic_crs, crs, always_xy=True)
transformer.transform_bounds(*crs.area_of_use.bounds)
Read more comments on GitHub >

github_iconTop Results From Across the Web

Overview of Coordinate Reference Systems (CRS) in R
Map coordinates of a point are computed from its ellipsoidal latitude and longitude by a standard formula known as a map projection. It...
Read more >
What does 'projected bounds' and 'WGS84 bounds' mean in ...
The projected bounds is this area in the units and projection of the CRS you are interested in while WGS84 bounds are those...
Read more >
Handling Spatial Projection & CRS - Data Carpentry
This layer contains the boundaries of all contiguous states in the U.S. Please note that these data have been modified and reprojected from...
Read more >
7 Reprojecting geographic data - Geocomputation with R
Datasets without a specified CRS can cause problems: all geographic coordinates have a coordinate system and software can only make good decisions around ......
Read more >
Coordinate Reference System and Spatial Projection - Earth Lab
Geographic CRS - The Good & The Less Good ... Geographic coordinate systems in decimal degrees are helpful when you need to locate...
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