Re: Convert BoundingBox data into lat/lon

Guillaume 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?
 

Join main@rasterio.groups.io to automatically receive all group messages.