Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting geotiff tiles directly #61

Open
sroboubi opened this issue Sep 4, 2018 · 1 comment
Open

Getting geotiff tiles directly #61

sroboubi opened this issue Sep 4, 2018 · 1 comment

Comments

@sroboubi
Copy link

sroboubi commented Sep 4, 2018

I'm trying to get some imagery from geotiff and display it as tiles on openlayers. The openlayers requests give me the bounding box of the tile it wants, so I use GeotiffImage.readRasters(). Even though the requested tile size matches the geotiff tiles, each readRasters call actually results in 4 getTileOrStrip() calls per sample. This seems very inefficient as each tile that open layers needs ends up taking 4 times longer than it should to retrieve. Possible solutions:

  1. Align openlayers tiles with the geotiff source tiles and use GeotiffImage.getTileOrStrip() directly. The result from getTileOrStrip() doesn't seem to be in the same format as what readRasters() returns, so what must I do to make it work?
  2. Have geotiff.js cache the returned tiles from getTileOrStrip() so that it doesn't need to fetch them again. Is there a way to do this?

Thanks.

@constantinius
Copy link
Member

Hi @sroboubi,

There is the cache options when creating a GeoTIFF, which is handed down to the GeoTIFFImage, resulting in a cache object to store already parsed tiles/strips. I see that it is not consistently exposed for all factory functions (which should be easy to fix), but for the fromUrl it s there:

const tiff = await GeoTIFF.fromUrl(url, { cache: true });

Have you already tried it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants