GeoTIFF / geoblaze

Blazing Fast JavaScript Raster Processing Engine
http://geoblaze.io
MIT License
181 stars 28 forks source link

COG gives negative array length over network, but works from fs #198

Closed acao closed 1 year ago

acao commented 1 year ago

Describe the bug

This derived, single band COG works wonderfully with geoblaze.parse() using a local fs.readFile buffer, but when i use the same file over the localhost network with geoblaze.parse(), I get this error:

error: RangeError: Invalid typed array length: -22011422

then I get repeats of this error in a loop, with varying negative array lengths.

unhandledRejection: RangeError: Invalid typed array length: -22018832

Expected behavior The geoblaze.parse() should work over the network if the local filesystem approach is working for that file.

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

Additional context

The file was generated from this source vector file:

https://files.isric.org/soilgrids/latest/data/wrb => MostProbable.vrt

using:

gdal_translate MostProbable.vrt soilsout.tiff -outsize 7410 5305

also, I have checked the way the local fileserver is serving the files, and I think it's working fine?

`gdalinfo` output ``` Driver: GTiff/GeoTIFF Files: soilsout.tiff soilsout.tiff.aux.xml Size is 7410, 5305 Coordinate System is: GEOGCRS["WGS 84", ENSEMBLE["World Geodetic System 1984 ensemble", MEMBER["World Geodetic System 1984 (Transit)"], MEMBER["World Geodetic System 1984 (G730)"], MEMBER["World Geodetic System 1984 (G873)"], MEMBER["World Geodetic System 1984 (G1150)"], MEMBER["World Geodetic System 1984 (G1674)"], MEMBER["World Geodetic System 1984 (G1762)"], MEMBER["World Geodetic System 1984 (G2139)"], ELLIPSOID["WGS 84",6378137,298.257223563, LENGTHUNIT["metre",1]], ENSEMBLEACCURACY[2.0]], PRIMEM["Greenwich",0, ANGLEUNIT["degree",0.0174532925199433]], CS[ellipsoidal,2], AXIS["geodetic latitude (Lat)",north, ORDER[1], ANGLEUNIT["degree",0.0174532925199433]], AXIS["geodetic longitude (Lon)",east, ORDER[2], ANGLEUNIT["degree",0.0174532925199433]], USAGE[ SCOPE["Horizontal component of 3D system."], AREA["World."], BBOX[-90,-180,90,180]], ID["EPSG",4326]] Data axis to CRS axis mapping: 2,1 Origin = (-180.000000000000000,83.999167206000010) Pixel Size = (0.048582988178158,-0.026390193704064) Metadata: AREA_OR_POINT=Area Image Structure Metadata: INTERLEAVE=BAND Corner Coordinates: Upper Left (-180.0000000, 83.9991672) (180d 0' 0.00"W, 83d59'57.00"N) Lower Left (-180.0000000, -56.0008104) (180d 0' 0.00"W, 56d 0' 2.92"S) Upper Right ( 179.9999424, 83.9991672) (179d59'59.79"E, 83d59'57.00"N) Lower Right ( 179.9999424, -56.0008104) (179d59'59.79"E, 56d 0' 2.92"S) Center ( -0.0000288, 13.9991784) ( 0d 0' 0.10"W, 13d59'57.04"N) Band 1 Block=7410x1 Type=Byte, ColorInterp=Gray NoData Value=255 VALUE 0 0 RSG 2 0 0 Acrisols 1 Albeluvisols 2 Alisols 3 Andosols 4 Arenosols 5 Calcisols 6 Cambisols 7 Chernozems 8 Cryosols 9 Durisols 10 Ferralsols 11 Fluvisols 12 Gleysols 13 Gypsisols 14 Histosols 15 Kastanozems 16 Leptosols 17 Lixisols 18 Luvisols 19 Nitisols 20 Phaeozems 21 Planosols 22 Plinthosols 23 Podzols 24 Regosols 25 Solonchaks 26 Solonetz 27 Stagnosols 28 Umbrisols 29 Vertisols ```

Duplicates?

I saw both open and closed issues in your org repos with similar errors, but the contexts and problem definition seemed quite different, and I'm not sure which library is throwing the error because all errors are coming from dist/geoblaze.node.min.js. My guess is this is georaster related?

p.s thank you for this lovely library and all you've done for the amazing COG ecosystem!!!

acao commented 1 year ago

for some reason, it didn't work with next.js public directory using express, but it did work over network from blob storage. comparing and contrasting the headers left me stumped, so, although this is unsolved, i'm assuming its out of scope for this project, thanks again!