[gdal-dev] gdal_edit with ECW, parameter woes, documentation is probematic

Even Rouault even.rouault at spatialys.com
Tue Jul 26 06:40:32 PDT 2016


Mark,

I've tried to incorporate your feedback in this changeset:

@@ -173,6 +173,16 @@
 the PROJ, DATUM or UNITS with SetMetadataItem(), the later values will 
override the values
 built from the projection string.<p>
 
+All those can for example be modified with the -a_ullr, -a_srs or -mo switches
+of the <a href="gdal_edit.html">gdal_edit.py</a> utility.<p>
+
+For example:
+<pre>
+gdal_edit.py -mo DATUM=WGS84 -mo PROJ=GEODETIC -a_ullr 7 47 8 46 test.ecw
+
+gdal_edit.py -a_srs EPSG:3068 -a_ullr 20800 22000 24000 19600 test.ecw
+</pre>
+
 <h3>File Metadata Keys: </h3>
 
 <ul>
@@ -190,7 +200,12 @@
 <li>COLORSPACE
 <li>COMPRESSION_DATE
 <li>COMPRESSION_RATE_ACTUAL
-<li>COMPRESSION_RATE_TARGET
+<li>COMPRESSION_RATE_TARGET. This is the percentage of the target compressed
+file size divided by the uncompressed file size. This is equal to
+100 / (100 - TARGET) where TARGET is the value of the TARGET
+creation option used at file creation, so a COMPRESSION_RATE_TARGET=1 is
+equivalent to a TARGET=0 (ie no compression), COMPRESSION_RATE_TARGET=5 is
+equivalent to TARGET=80 (ie dividing uncompressed file size by 5), etc...
 <li>VERSION
 </ul>
 
Even


> While writing this, I figured put most of the problems, so this note will
> be more about suggestion in making the documentation more usable.
> 
> I am going to receive an amount of ecw files that, for whatever reason, do
> not contain the georeferenced information.
> 
> For the first image received, gdalinfo shows the following:
> 
> Driver: ECW/ERDAS Compressed Wavelets (SDK 3.x)
> Files: 1989.423C_42348.5000.ecw
> Size is 8001, 6001
> Coordinate System is `'
> Metadata:
>   COLORSPACE=GREYSCALE
>   COMPRESSION_RATE_TARGET=5
>   VERSION=2
> Corner Coordinates:
> Upper Left  (    0.0,    0.0)
> Lower Left  (    0.0, 6001.0)
> Upper Right ( 8001.0,    0.0)
> Lower Right ( 8001.0, 6001.0)
> Center      ( 4000.5, 3000.5)
> Band 1 Block=256x256 Type=Byte, ColorInterp=Gray
>   Description = Grayscale
>   Overviews: 4000x3000, 2000x1500, 1000x750, 500x375, 250x187
> 
> Since I know the position, I did the following:
> 
> 1) gdal_translate -of GTiff -a_nodata 135 -a_srs EPSG:3068 -a_ullr 20800
> 22000 24000 19600 1989.423C_42348.5000.ecw 1989.423C_42348.5000.3068.tif
> 
> 2) gdal_translate -of ECW -co TARGET=0 -a_srs EPSG:3068
> 1989.423C_42348.5000.3068.tif 1989.423C_42348.5000.3068.tif.ecw
> 
> gdalinfo now shows the projection information.
> - but with 'COMPRESSION_RATE_TARGET=1' instead of 5
> -- no doubt due to the '-co TARGET=0' (which I have no idea what it means)
> 
> gdal_translate has a note with the '-co'
> 'See format specific documentation for legal creation options for each
> format'
> a: <a href="http://www.gdal.org/formats_list.html">See format specific
> documentation for legal creation options for each format</a>
> which then leads to http://www.gdal.org/frmt_ecw.html
> - where TARGET is then explained (percentage)
> -- but no explanation on what 'COMPRESSION_RATE_TARGET' is
> ---> '-co TARGET=50' (percent) = 'COMPRESSION_RATE_TARGET=2'
> ---> '-co TARGET=75' (percent) = 'COMPRESSION_RATE_TARGET=4'
> ---> '-co TARGET=99.99' (percent) = 'COMPRESSION_RATE_TARGET=9997'
> A comparison chart would be useful here
> - comparing what gdalinfo shows to what gdal_translate needs
> (I still do not know what TARGET setting is needed to get
> COMPRESSION_RATE_TARGET=5)
> 
> What I would like to know is: can gdal_edit.py be used to achieve the same
> result?
> - base on another found sample, I worked this out, since I have never used
> the combination -a_srs/-a_ullr before
> -- wasted a lot of time in the past creating a world-file for this task
> 
> gdal_edit  -a_srs EPSG:3068 -a_ullr 20800 22000 24000 19600
> 1989.423C_42348.5000.ecw
> 
> So for both 'gdal_translate' and 'gdal_edit' a practical sample to set the
> missing georeferenced information would be useful
> - while searching I saw a lot of reports of people receiving ecw file 'raw'
> and wondering how to get it in
> 
> Once one knows it, it is easy
> But it has be hours since I found this sample:
> gdal_edit -mo DATUM=WGS84 -mo PROJ=GEODETIC -a_ullr 7 47 8 46 test.ecw
> 
> and trying to adapt it to work with a non-wsg84 system.
> 
> Mark Johnson, Berlin Germany

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com


More information about the gdal-dev mailing list