Giter Site home page Giter Site logo

geotiff / geotiff-stats Goto Github PK

View Code? Open in Web Editor NEW
14.0 3.0 1.0 110 KB

Get Statistics from a Large GeoTIFF while Using a Low Amount of Memory

License: MIT License

JavaScript 85.26% Shell 3.14% HTML 11.61%
geotiff statistics minimum maximum satellite satellite-imagery

geotiff-stats's People

Contributors

danieljdufour avatar dependabot[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

holusormi

geotiff-stats's Issues

Add support for quantiles and standardDeviation

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)
  }
}

Add options: optionally skip calculating of min/max via tiling

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 });

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.