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
878 stars 183 forks source link

GeoTIFF COG only works in projection EPSG:3857? #271

Closed digoburigo closed 2 years ago

digoburigo commented 2 years ago

I have a problem that the COG only works if the original GeoTIFF, before the conversion, is already in EPSG:3857. Is this a pre-requisite of COG's?

DanielJDufour commented 2 years ago

It shouldn't be a limitation. It may be a limitation of the library used to pull or render data from the COG. I can speak to limitations with georaster, but I'm not as familiar with other libraries.

digoburigo commented 2 years ago

Oh ok, so one more doubt. I'm working with OpenLayers and the Map View it's setted to EPSG:3857. So to make the COG work it's projection must be in EPSG:3857, or it can be in another projection and geotiffjs is going to convert on the fly?

constantinius commented 2 years ago

This issue is actually related to OpenLayers. geotiff.js itself does not really bother itself with projection, but OpenLayers has to. To my knowledge, OpenLayers does support COGs with other projections, you have to get the projection information somehow. This can be done using this method: https://openlayers.org/en/latest/apidoc/module-ol_source_GeoTIFF-GeoTIFFSource.html#getProjection

digoburigo commented 2 years ago

Yeah, that's right, there is already an issue with this topic https://github.com/openlayers/openlayers/issues/13197, so others can continue to follow this question. Thanks for the time and explanation!