Git Product home page Git Product logo

Comments (3)

DanielJDufour avatar DanielJDufour commented on July 30, 2024 1

hey, @kandersolar . Great question! I'll think on your proposal in the coming weeks, but wanted to let you know quick that you can access the geotiff via a "private" undocumented property on the GeoRaster object called "_geotiff", like

const georaster = parseGeoRaster(url);

const tiff = georaster._geotifff;
const img = await tiff.getImage();
img.getGDALMetadata();

I'd recommend locking your georaster version if you take this approach. I can't say if this property will exist on the next major release of georaster because it's an undocumented non-public property subject to change.

from georaster.

kandersolar avatar kandersolar commented on July 30, 2024

Thanks for pointing that out! I was loading from a pre-fetched ArrayBuffer, which I guess is why I didn't notice the _geotiff attribute (seems like it is only populated when parsing from URL?).

Using that approach does indeed work to get me the metadata I'm after. However, I then ran into other problems where the georaster object no longer had mins, maxs etc attributes, nor was I able to figure out how to calculate them myself with geoblaze. I also ran into trouble with using geoblaze.identify to extract pixel values.

Here is a slimmed-down version of what I am trying to run:

    const url = window.location.origin + "/geotiffs/" + filename;
    const georaster = await parseGeoraster(url, {}, true);
    const tiff = georaster._geotiff;
    const img = await tiff.getImage();

    console.log(img.getGDALMetadata());  // works
    console.log(georaster.mins); // undefined
    console.log(georaster.maxs); // undefined
    console.log(georaster.ranges); // undefined

Any hints what I am doing wrong?

from georaster.

DanielJDufour avatar DanielJDufour commented on July 30, 2024

Hey, that's a good catch. You're not doing anything wrong per se. It's just that the API for GeoRaster definitely needs a refresh with more customizability. I'm working on a new major version, but can't say when that would be done.

The original logic behind not calculating stats when loaded from a url was to avoid situations where we tried to calculate stats on really large geotiffs, potentially fetching hundreds of megabytes.

If you want to calculate stats, you could use geoblaze like:

import geoblaze from "geoblaze";

const stats = await geoblaze.stats("https://example.org/imagery.tif", undefined, { stats: ["max", "min", "range"] });

Feel free to create an issue on https://github.com/GeoTIFF/geoblaze/issues regarding the identify problem.

I should mention that if you prefer not to use geoblaze, you could use: https://github.com/geotiff/geotiff-stats

Lastly, I don't think we have any test data on https://github.com/geotiff/test-data where the gdal metadata includes AUTHOR and CREATION_DATE. Would you be open to contributing your geotiff to https://github.com/geotiff/test-data? That'll help increase the visibility of your test case in the ecosystem of libraries that use this test data.

from georaster.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.