geotiffjs / geotiff.js

geotiff.js is a small library to parse TIFF files for visualization or analysis. It is written in pure JavaScript, and is usable in both the browser and node.js applications.
https://geotiffjs.github.io/
MIT License
860 stars 181 forks source link

Bounding box of returned COG tiles? #326

Closed PostholerCom closed 1 year ago

PostholerCom commented 1 year ago

When getting overviews from a COG geotiff using:

tiff.readRasters({ bbox: [bounds._southWest.lng, bounds._southWest.lat,bounds._northEast.lng,bounds._northEast.lat] ,width: dims.x ,height: dims.y } ...how do you get the bounding box of the returned rasters? NOT the bbox of the entire raster.

Thanks!

DanielJDufour commented 1 year ago

Hi, @PostholerCom . We solved this with geotiff-read-bbox (except for geotiffs with a rotation). If you find it useful, I encourage you to review https://github.com/GeoTIFF/geotiff-read-bbox/blob/main/index.mjs and https://github.com/DanielJDufour/snap-bbox/blob/main/lib/snap-bbox.js.

PostholerCom commented 1 year ago

Thanks @DanielJDufour I'll take a look at this!