Comments (3)
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.
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.
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)
- Load from Blob on front-end HOT 2
- bilinear resample method is hard coded and not always a sensible option HOT 4
- Should be able to parse GeoTIFFs even if don't have projection information
- Function to return values iterator
- Uncaught Promise Rejection
- Parse Georaster back to ArrayBuffer HOT 3
- webpack 5 support
- parseGeoraster .ovr detection HOT 5
- parseGeoraster: catching error HOT 2
- Is it possible to combine the values from two rasters? I.e. raster math client side HOT 4
- maxs/mins/ranges calculation incorrect HOT 2
- Support passing HTTP headers to the GeoTiff request HOT 4
- Metadata values are ignored when loading COG from URL HOT 1
- rasterio-generated geotiffs have wrong metadata HOT 2
- Missing Tiles on COG edges where tile includes transparency HOT 5
- noDataValue is not ignored to compute mins HOT 1
- CORS with georaster/georaster-for-leaflet HOT 2
- COG area displayed, but COG itself appears to not be shown HOT 5
- load from simple object on front-end, georaster not work with geoblaze
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from georaster.