[gdal-dev] convert raster to raw table ?

Michael Sumner mdsumner at gmail.com
Thu Dec 12 04:59:32 PST 2024


Ah sweet, yes that's exactly it  I remember reading about this new
interface you wrote.

Thanks!!!!

Cheers, Mike

On Thu, 12 Dec 2024, 22:41 Even Rouault, <even.rouault at spatialys.com> wrote:

> Michael,
>
> doesn't do exactly what you want, but should be easy to modify to satisfy
> your requirements:
> https://github.com/OSGeo/gdal/blob/master/apps/gdal2ogr.c
>
> Even
> Le 12/12/2024 à 06:40, Michael Sumner via gdal-dev a écrit :
>
> Hi, I'd like to be able to create a tabular version efficiently directly
> from a raster. I can do this in scripting but is there a utility- or api-
> way to do this?
>
> I literally just want a Parquet file with a column for each band from a
> raster, with raw pixel values, no index, no coordinates, no rat or anything
> like that. I have very common workflows for this where the georeferencing
> (bbox, shape, crs) is just used manually.
>
> If this doesn't exist a barebones outline would be amazing (!), and (I)
> could add features like column names, cell index or row/col index,
> coordinates, sparse representation for missing values etc etc.
>
> An imagined -info output would look like this for a 2x3 raster with 2
> bands and values 1:6 in band 1, and values 7:12 in band 2 described  below.
>
> thanks so much, Mike
>
>
>
>
> gdalinfo file.tif
> Driver: GTiff/GeoTIFF
> Files: file.tif
> Size is 3, 2
> Origin = (0.000000000000000,2.000000000000000)
> Pixel Size = (1.000000000000000,-1.000000000000000)
> Image Structure Metadata:
>   COMPRESSION=LZW
>   INTERLEAVE=PIXEL
> Corner Coordinates:
> Upper Left  (   0.0000000,   2.0000000)
> Lower Left  (   0.0000000,   0.0000000)
> Upper Right (   3.0000000,   2.0000000)
> Lower Right (   3.0000000,   0.0000000)
> Center      (   1.5000000,   1.0000000)
> Band 1 Block=3x2 Type=UInt32, ColorInterp=Gray
>   Description = a
>   Min=1.000 Max=6.000
>   Minimum=1.000, Maximum=6.000, Mean=-9999.000, StdDev=-9999.000
>   NoData Value=4294967295
>   Metadata:
>     STATISTICS_MINIMUM=1
>     STATISTICS_MAXIMUM=6
>     STATISTICS_MEAN=-9999
>     STATISTICS_STDDEV=-9999
> Band 2 Block=3x2 Type=UInt32, ColorInterp=Undefined
>   Description = b
>   Min=7.000 Max=12.000
>   Minimum=7.000, Maximum=12.000, Mean=-9999.000, StdDev=-9999.000
>   NoData Value=4294967295
>   Metadata:
>     STATISTICS_MINIMUM=7
>     STATISTICS_MAXIMUM=12
>     STATISTICS_MEAN=-9999
>     STATISTICS_STDDEV=-9999
>
>
>
> INFO: Open of `file.parquet'
>       using driver `Parquet' successful.
>
> Layer name: file
> Geometry: None
> Feature Count: 6
> Layer SRS WKT:
> (unknown)
> a: Integer (0.0)
> b: Integer (0.0)
> OGRFeature(file):0
>   a (Integer) = 1
>   b (Integer) = 7
>
> OGRFeature(file):1
>   a (Integer) = 3
>   b (Integer) = 9
>
> OGRFeature(file):2
>   a (Integer) = 5
>   b (Integer) = 11
>
> OGRFeature(file):3
>   a (Integer) = 2
>   b (Integer) = 8
>
> OGRFeature(file):4
>   a (Integer) = 4
>   b (Integer) = 10
>
> OGRFeature(file):5
>   a (Integer) = 6
>   b (Integer) = 12
>
>
> --
> Michael Sumner
> Research Software Engineer
> Australian Antarctic Division
> Hobart, Australia
> e-mail: mdsumner at gmail.com
>
> _______________________________________________
> 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.
> Butcher of all kinds of standards, open or closed formats. At the end, this is just about bytes.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20241212/1b6621c5/attachment-0001.htm>


More information about the gdal-dev mailing list