[gdal-dev] Reading raster file

Javier Jimenez Shaw j1 at jimenezshaw.com
Wed May 10 15:12:33 PDT 2023


Thanks Even

I realized that "adjusting" the header a bit, it is read by GDAL as AAIGrid
https://gdal.org/drivers/raster/aaigrid.html

NCOLS 1440
NROWS 2220
XLLCENTER -76.0000000000
YLLCENTER -57.0007400000
CELLSIZE 0.01666700000000000
NODATA_VALUE -999


On Tue, 9 May 2023 at 19:12, Even Rouault <even.rouault at spatialys.com>
wrote:

> Javier,
>
> The error message comes from the XYZ driver which is confused and believes
> it might be for it, but this is definitely not a .xyz file
>
> There are quite a lot of variations of ASCII grid formats. This one
> reminds me a bit of the IGN France ones that are handled by the
> https://github.com/OSGeo/gdal-extra-drivers/blob/master/src/ignfheightasciigrid/ignfheightasciigrid.cpp
> driver (note that it has been retired as out of tree), but I can see that
> this .gri file has min_lat, max_lat first whereas the French ones have
> min_lon, max_lon :-)
>
> I've tried with
> https://www.isgeoid.polimi.it/Geoid/America/Argentina/public/GEOIDEAR16_20160419.isg,
> linked from
> https://www.isgeoid.polimi.it/Geoid/America/Argentina/argentina2016_g.html
> .  Hopefully it has the same content as the .gri file. I had to push in
> https://github.com/OSGeo/gdal/pull/7730 a fix to open it as the rounding
> of coordinates & resolution is quite rough in those .isg files.
>
> with the fix:
>
> $ gdalinfo GEOIDEAR16_20160419.isg -mm
> Driver: ISG/International Service for the Geoid
> Files: GEOIDEAR16_20160419.isg
> Size is 1440, 2220
> Coordinate System is:
> GEOGCRS["WGS 84",
>     DATUM["World Geodetic System 1984",
>         ELLIPSOID["WGS 84",6378137,298.257223563,
>             LENGTHUNIT["metre",1]]],
>     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]],
>     ID["EPSG",4326]]
> Data axis to CRS axis mapping: 2,1
> Origin = (-76.009853500000006,-20.008733500000002)
> Pixel Size = (0.016667000000000,-0.016667000000000)
> Metadata:
>   MODEL_NAME=GEOIDEAR16
>   MODEL_TYPE=gravimetric
> Corner Coordinates:
> Upper Left  ( -76.0098535, -20.0087335) ( 76d 0'35.47"W, 20d 0'31.44"S)
> Lower Left  ( -76.0098535, -57.0094735) ( 76d 0'35.47"W, 57d 0'34.10"S)
> Upper Right ( -52.0093735, -20.0087335) ( 52d 0'33.74"W, 20d 0'31.44"S)
> Lower Right ( -52.0093735, -57.0094735) ( 52d 0'33.74"W, 57d 0'34.10"S)
> Center      ( -64.0096135, -38.5091035) ( 64d 0'34.61"W, 38d30'32.77"S)
> Band 1 Block=1440x1 Type=Float32, ColorInterp=Undefined
>     Computed Min/Max=-6.007,45.203
>   NoData Value=-9999
>   Unit Type: meters
>
>
> Note that CRS is hard coded to WGS 84 by the driver, and should be altered
> to something more relevant.
>
> Even
>
>
> Le 09/05/2023 à 17:21, Javier Jimenez Shaw a écrit :
>
> Hi
>
> I want to read the Argentinian Geoid model with GDAL.
> It is an ascii raster floating-point file with just one band.
> https://dnsg.ign.gob.ar/apps/geoidear/documentos/GEOIDE-Ar16.gri (22 MB)
>
>
> The content is starts with:
>
>    -57.0007400000   -20.0166670000   -76.0000000000   -52.0161870000
> 0.01666700000000001   0.01666700000000000
>
> 13.278 13.310 13.321 13.322 13.357 13.383 13.429 13.442
> 13.477 13.504 13.516 13.549 13.574 13.549 13.570 13.602
> 13.623 13.584 13.574 13.661 13.766 13.802 13.823 13.821
> 13.835 13.881 13.907 13.944 14.005 14.060 14.085 14.070
> 14.098 14.153 14.221 14.259 14.277 14.396 14.446 14.451
> 14.390 14.471 14.572 14.645 14.681 14.674 14.702 14.745
> 14.796 14.843 14.872 14.872 14.952 15.065 15.110 15.053
> 15.056 15.050 15.095 15.126 15.125 15.154 15.222 15.261
> 15.244 15.369 15.480 15.519 15.464 15.462 15.505 15.477
>
> and finishes with
>
> 19.069 19.065 19.057 19.047 19.039 19.031 19.021 19.012
> 19.004 18.997 18.990 18.987 18.987 18.988 18.991 18.998
> 19.001 19.009 19.027 19.042 19.067 19.141 19.209 19.208
> 19.179 19.156 19.147 19.150 19.152 19.156 19.164 19.155
>
> Total number of lines: 399602
>
> It seems to have a width of 1440 and height of 2220.
>
> gdalinfo says
>
> $ gdalinfo GEOIDE-Ar16.gri
> ERROR 1: Maximum number of characters allowed reached.
> ERROR 1: Couldn't determine X spacing
> gdalinfo failed - unable to open 'GEOIDE-Ar16.gri'.
>
> I do not know which exact format it is. I can deduce the meaning of the
> values (specially knowing that it covers Argentina ;), but I would like to
> read it directly if possible.
>
> Is that a know format for GDAL?
>
> Thanks,
> Javier.
> .___ ._ ..._ .. . ._.  .___ .. __ . _. . __..  ... .... ._ .__
>
> _______________________________________________
> gdal-dev mailing listgdal-dev at lists.osgeo.orghttps://lists.osgeo.org/mailman/listinfo/gdal-dev
>
> -- http://www.spatialys.com
> My software is free, but my time generally not.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20230511/dad21b04/attachment.htm>


More information about the gdal-dev mailing list