Comments (3)
Hey, sorry about that. Nothing you've done wrong. There's just often weirdness when dealing with no data values and Float 32 numbers. There's a bit of discrepancy between the No Data Value provided in the GeoTIFF metadata ("-3.39999999999999996e+038\x00"
) and what can actually be represented in JavaScript (-3.3999999521443642e+38
). I think the issue is that whatever system is writing the noDataValue doesn't change the value based on the number of bits in encoding (but that's just a hunch). Unfortunately, it'd take some time to develop a proper fix.
Fortunately though, there's two workarounds possible. The easiest is to pass in a new filter function to the stats call:
const filter = value => value !== undefined && value !== -3.3999999521443642e+38;
geoblaze.stats(gsoc, geometry, undefined, filter);
The filter function is undocumented functionality, so I can't commit to maintaining that specific function param in the future. So if you go this route, I'd recommend locking your geoblaze version in your package.json (if you haven't already).
Alternatively, another solution, which is guaranteed to work into the future is to correct the noDataValue after parsing like so:
import parseGeoRaster from "georaster";
const georaster = await parseGeoRaster(url);
georaster.noDataValue = -3.3999999521443642e+38;
geoblaze.stats(georaster, geometry);
This is guaranteed to work because it's using georaster's public API, which I will always do my best to maintain.
Let me know if this helps. Happy to provide more assistance.
Also, thank you so much for alerting me to this issue and this great dataset. Now with a publicly available geotiff file in hand, I'll be able to write some tests and starting thinking about how to solve this issue in the future.
from geoblaze.
I'm also not entirely sure whether .mean
produces correct results... It seems that it doesn't actually pick the mean, but produces an average? Is that possible? Given these values, I had expected mean to be (pseudo-code alert):
const values = [-3.39e+38, 42, 42]
expect(mean(value)).toBe(values[1]);
from geoblaze.
So, I've found the area in the dataset explorer and these are indeed "correct" values (although they're obviously gibberish). Is there a way to filter these out somehow? I couldn't find an appropriate API for it, but I'm assuming that's because I'm a dum-dum :D.
from geoblaze.
Related Issues (20)
- Composite individual band GeoTIFFs to single GeoRaster HOT 6
- add proper polygon hole support HOT 2
- add density to reproject-bbox call HOT 1
- COG gives negative array length over network, but works from fs HOT 1
- add support for skewed images
- `rasterCalculator` with polygon clipping? HOT 3
- Remove worker_threads warning on initial import HOT 1
- add support for precise geometry expressed with numerical strings
- replace most logic in utils.getBoundingBox with bbox-fns/calc.js HOT 1
- NaN values cause unexpected results
- improve isBbox
- Can't get stats within a geojson geometry HOT 2
- validate GeoJSON Input
- A multipolygon and 2 single polygons give differing results HOT 2
- Large error when raster extent and geometry bbox don't overlap HOT 4
- bbox per polygon HOT 1
- Improve accuracy of re-projected geometries HOT 1
- Multipolygon producing unexpected sum - antimeridian crossing scenario HOT 5
- investigate multi-band performance HOT 9
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 geoblaze.