geotiff / geotiff-stats Goto Github PK
View Code? Open in Web Editor NEWGet Statistics from a Large GeoTIFF while Using a Low Amount of Memory
License: MIT License
Get Statistics from a Large GeoTIFF while Using a Low Amount of Memory
License: MIT License
I've been doing something similar in my geotiff-server. The other stats I found happy for colour balancing were quantiles at 2% and 98%, and the standard deviation
In my code it looked something like
import {min, max, quantile, standardDeviation} from 'simple-statistics'
function getBasicStats (arr) {
var filtered = arr.filter(function (element) {
return element !== -999
})
return {
percentiles: [quantile(filtered, 0.02), quantile(filtered, 0.98)],
min: min(filtered),
max: max(filtered),
stdDeviation: standardDeviation(filtered)
}
}
Thanks for your work on this, this module has saved me a lot of work in a project!
I'm not sure the require path is correct in index.js
Changing const { getDecoder } = require('geotiff/dist/compression');
to const { getDecoder } = require('geotiff');
works for me.
Sometimes people will want to try to grab the min/max value from the GDAL_METADATA (if it exists), but won't want to wait to get the min/max by grabbing every tile from a COG's overview or raw data if no overview exists. (This can take roughly 15 seconds for Landsat overviews).
Here's a possible API solution:
const { bands } = getStats(image, { quick: true });
Alternatively, a user could specify what percentage of tiles to sample (defaulting to 1.00 for 100%). In the following example, we sample roughly 50% of the tiles:
const { bands } = getStats(image, { sampleSize: 0.5 });
If a user doesn't want to sample any tiles, they can use:
const { bands } = getStats(image, { sampleSize: 0 });
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.