[gdal-dev] convert raster to raw table ?
Michael Sumner
mdsumner at gmail.com
Thu Dec 12 17:05:31 PST 2024
Hmm, I see CSV special-case is close to what I need so I'll try modifying
this along those lines.
We could have -type "none", and a null value for "all bands" - and use the
CSV special-case logic to write to other tabular formats.
Cheers, Mike
On Thu, Dec 12, 2024 at 11:59 PM Michael Sumner <mdsumner at gmail.com> wrote:
> 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.
>>
>>
--
Michael Sumner
Research Software Engineer
Australian Antarctic Division
Hobart, Australia
e-mail: mdsumner at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20241213/3c16b5eb/attachment.htm>
More information about the gdal-dev
mailing list