Convert BoundingBox data into lat/lon


toku2288@...
 

Hi Guillaume,

Thanks, It worked. I previously tried using the CRS EPSG:3857 using that method, and it returned lat/lon values out of range. Is there some way to get the EPSG:3857 values?


Guillaume Lostis <g.lostis@...>
 

Hi,

The rasterio.warp.transform_bounds function should do what you want: https://rasterio.readthedocs.io/en/latest/api/rasterio.warp.html#rasterio.warp.transform_bounds

Pass it the CRS of your dataset as src_crs, CRS({'init': 'EPSG:4326'}) as dst_crs, and your bounds, and you will get your bounds in lon/lat as output.

Regards, 

Guillaume Lostis 

On Tue, 21 Jul 2020, 09:36 toku2288 via groups.io, <toku2288=protonmail.com@groups.io> wrote:
Hi, I need to convert the bounding box data of a TIF file to lat/lon co-ordinates so I can request data from another API

GridTIF.bounds returns a BoundingBox object like the following:
BoundingBox(left=-2638055.0614613006, bottom=340165.4847189281, right=2410944.9385386994, top=5922165.484718928)
Is there some way to convert this to lat/lon of the two corners in it's current CRS?
 


toku2288@...
 

Hi, I need to convert the bounding box data of a TIF file to lat/lon co-ordinates so I can request data from another API

GridTIF.bounds returns a BoundingBox object like the following:
BoundingBox(left=-2638055.0614613006, bottom=340165.4847189281, right=2410944.9385386994, top=5922165.484718928)
Is there some way to convert this to lat/lon of the two corners in it's current CRS?