How to use the geotiff/src/main.fromUrl function in geotiff

To help you get started, we’ve selected a few geotiff examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github geotiffjs / cog-explorer / src / actions / scenes / index.js View on Github external
usedPipeline = usedPipeline || landsat8Pipeline;
        } else {
          bands = new Map(
            files
              .filter(file => /.TIFF?$/gi.test(file))
              .map((file, i) => [i, file]),
          );
        }

        const hasOvr = typeof files.find(file => /.TIFF?.OVR$/i.test(file)) !== 'undefined';
        dispatch(
          addScene(url, bands, red, green, blue, false, hasOvr, false, attribution, usedPipeline)
        );
      } else if (contentType === 'image/tiff') {
        const tiff = await fromUrl(url);
        const image = await tiff.getImage();

        const samples = image.getSamplesPerPixel();
        const bands = new Map();
        for (let i = 0; i < samples; ++i) {
          bands.set(i, url);
        }

        let [red, green, blue] = [];
        if (samples === 3 || typeof image.fileDirectory.PhotometricInterpretation !== 'undefined') {
          red = 0;
          green = 1;
          blue = 2;
        } else {
          red = 0;
          green = 0;
github geotiffjs / cog-explorer / src / components / mapview.jsx View on Github external
async getImage(sceneId, url, hasOvr = true) {
    if (!this.sceneSources[sceneId]) {
      this.sceneSources[sceneId] = {};
    }
    if (!this.sceneSources[sceneId][url]) {
      if (hasOvr) {
        this.sceneSources[sceneId][url] = fromUrls(url, [`${url}.ovr`]);
      } else {
        this.sceneSources[sceneId][url] = fromUrl(url);
      }
    }
    return this.sceneSources[sceneId][url];
  }