I'm building an API where user can insert a number (3857, 27700,etc.) and my API will give the projected bounds. I'm using pyproj's

crs_number = 27700    
crs_custom = CRS.from_user_input(crs_number)

this function is giving me bounds but it is showing bounds like


instead of


How do I get the expected bounds?


1 Answer 1


Here is simple solution following the @mikewatt advise

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

Then project your bottom left corner and top right corner in the output crs :

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


Following this question I asked on github and thanks to @snowman you can use :

from pyproj import CRS, Transformer

crs = CRS("EPSG:3857")
transformer = Transformer.from_crs(crs.geodetic_crs, crs, always_xy=True)

you can find the issue and the PR on github.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.