Scott,
due to the Abstraction word in GDAL , doing a gdal_translate in the same
format doesn't automatically applies the characteristics from the input
dataset to the output one, because in general you translate into a
different format, or if it is in the same format, you may apply options
to gdal_translate that could invalidate the characteristics of the input
dataset. So to do what you want, you need to write a specialized code.
You would need to create a CreateCopy() implementation in the ISCE
driver that fetches from the source dataset the original scheme (it
would have to be expose as a INTERLEAVING metadata item in the ISCE
metadata domain for example), and uses that to force the SCHEME creation
option.
https://github.com/OSGeo/gdal/blob/master/gdal/frmts/raw/ehdrdataset.cpp#L1811
would probably be the closest starting point.
But you may also need the logic at
https://github.com/OSGeo/gdal/blob/master/gdal/frmts/pds/pds4dataset.cpp#L4477
to extract the source dataset from the in-memory VRT created by
gdal_translate if applying for example a subsetting option.
Even
Le 24/09/2021 à 01:45, Scott Staniewicz a écrit :
I've got a 2 band, band-interleaved-line file gendered from the ISCE
software. I was doing some subsetting of it with gdal_translate, and I
noticed that the format got changed to BIP:
$ ls
20130719_20150427.unw 20130719_20150427.unw.vrt
20130719_20150427.unw.xml
$ grep -i -n3 scheme 20130719_20150427.unw.xml
96- <value>2</value>
97- <doc>Number of image bands.</doc>
98- </property>
99: <property name="scheme">
100- <value>BIL</value>
101: <doc>Interleaving scheme of the image.</doc>
102- </property>
103- <property name="width">
104- <value>586</value>
After running gdal_translate, the format has changed to BIP:
$ gdal_translate 20130719_20150427.unw test.unw -of ISCE
Input file size is 586, 882
0...10...20...30...40...50...60...70...80...90...100 - done.
(mapping) [scott@grace gdal-translate-bug]$ grep -i -n3 scheme
test.unw.xml
11- <property name="DATA_TYPE">
12- <value>FLOAT</value>
13- </property>
14: <property name="SCHEME">
15- <value>BIP</value>
16- </property>
17- <property name="BYTE_ORDER">
I'm assuming it's related to this line for creating a dataset with
default BIP:
https://github.com/OSGeo/gdal/blob/master/gdal/frmts/raw/iscedataset.cpp#L839
<https://github.com/OSGeo/gdal/blob/master/gdal/frmts/raw/iscedataset.cpp#L839>
But I'm not familiar enough with the gdal_translate code to know where
the options are getting generated and passed here.
Any advice on where might be a good place to fix the ISCE raster
generation?
Thanks,
Scott
_______________________________________________
gdal-dev mailing list
gdal-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/gdal-dev
--
http://www.spatialys.com
My software is free, but my time generally not.
_______________________________________________
gdal-dev mailing list
gdal-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/gdal-dev