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
859 stars 179 forks source link

How to Use a custom client #368

Closed sguimmara closed 1 year ago

sguimmara commented 1 year ago

I understand that fromSource() enables the caller to pass a custom source.

However, I don't see how to do that, since the class RemoteSource and BaseClient do not seem to be exported in the bundle ?

sguimmara commented 1 year ago

Actually, fromSource() is not exposed in the API it seems.

It would be great to be able to pass a custom source in order to use a custom client (we need to pass all HTTP request through a service that reorders and drops requests).

constantinius commented 1 year ago

fromSource() is actually GeoTIFF.fromSource() a static method on the GeoTIFF object, which is exposed.

sguimmara commented 1 year ago

Any reason why it is not a function exposed in https://geotiffjs.github.io/geotiff.js/module-geotiff.html ?

constantinius commented 1 year ago

It could be a free function in the module itself, but it would just be a proxy to GeoTIFF.fromSource() anyways. Does the static function work?

sguimmara commented 1 year ago

It could be a free function in the module itself, but it would just be a proxy to GeoTIFF.fromSource() anyways. Does the static function work?

I haven't tested yet. I will update the issue with my results :)