Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
acao opened this issue Apr 26, 2023 · 1 comment
Closed

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

acao opened this issue Apr 26, 2023 · 1 comment

Comments

@acao
Copy link

acao commented Apr 26, 2023

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

  • OS: OSX M1
  • Runtume: node.js
  • Version: 19.7.0

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
<GDALRasterAttributeTable tableType="thematic">
  <FieldDefn index="0">
    <Name>VALUE</Name>
    <Type>0</Type>
    <Usage>0</Usage>
  </FieldDefn>
  <FieldDefn index="1">
    <Name>RSG</Name>
    <Type>2</Type>
    <Usage>0</Usage>
  </FieldDefn>
  <Row index="0">
    <F>0</F>
    <F>Acrisols</F>
  </Row>
  <Row index="1">
    <F>1</F>
    <F>Albeluvisols</F>
  </Row>
  <Row index="2">
    <F>2</F>
    <F>Alisols</F>
  </Row>
  <Row index="3">
    <F>3</F>
    <F>Andosols</F>
  </Row>
  <Row index="4">
    <F>4</F>
    <F>Arenosols</F>
  </Row>
  <Row index="5">
    <F>5</F>
    <F>Calcisols</F>
  </Row>
  <Row index="6">
    <F>6</F>
    <F>Cambisols</F>
  </Row>
  <Row index="7">
    <F>7</F>
    <F>Chernozems</F>
  </Row>
  <Row index="8">
    <F>8</F>
    <F>Cryosols</F>
  </Row>
  <Row index="9">
    <F>9</F>
    <F>Durisols</F>
  </Row>
  <Row index="10">
    <F>10</F>
    <F>Ferralsols</F>
  </Row>
  <Row index="11">
    <F>11</F>
    <F>Fluvisols</F>
  </Row>
  <Row index="12">
    <F>12</F>
    <F>Gleysols</F>
  </Row>
  <Row index="13">
    <F>13</F>
    <F>Gypsisols</F>
  </Row>
  <Row index="14">
    <F>14</F>
    <F>Histosols</F>
  </Row>
  <Row index="15">
    <F>15</F>
    <F>Kastanozems</F>
  </Row>
  <Row index="16">
    <F>16</F>
    <F>Leptosols</F>
  </Row>
  <Row index="17">
    <F>17</F>
    <F>Lixisols</F>
  </Row>
  <Row index="18">
    <F>18</F>
    <F>Luvisols</F>
  </Row>
  <Row index="19">
    <F>19</F>
    <F>Nitisols</F>
  </Row>
  <Row index="20">
    <F>20</F>
    <F>Phaeozems</F>
  </Row>
  <Row index="21">
    <F>21</F>
    <F>Planosols</F>
  </Row>
  <Row index="22">
    <F>22</F>
    <F>Plinthosols</F>
  </Row>
  <Row index="23">
    <F>23</F>
    <F>Podzols</F>
  </Row>
  <Row index="24">
    <F>24</F>
    <F>Regosols</F>
  </Row>
  <Row index="25">
    <F>25</F>
    <F>Solonchaks</F>
  </Row>
  <Row index="26">
    <F>26</F>
    <F>Solonetz</F>
  </Row>
  <Row index="27">
    <F>27</F>
    <F>Stagnosols</F>
  </Row>
  <Row index="28">
    <F>28</F>
    <F>Umbrisols</F>
  </Row>
  <Row index="29">
    <F>29</F>
    <F>Vertisols</F>
  </Row>
</GDALRasterAttributeTable>

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
Copy link
Author

acao commented Apr 26, 2023

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!

@acao acao closed this as completed Apr 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant