<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">On 2014/12/15 12:53, Even Rouault
wrote:<br>
</div>
<blockquote cite="mid:201412151153.51700.even.rouault@spatialys.com"
type="cite">See <a class="moz-txt-link-freetext" href="http://www.gdal.org/gdal_edit.html">http://www.gdal.org/gdal_edit.html</a></blockquote>
<br>
Hi Even,<br>
I had a look at gdal_edit but could not get it to work on the server
as it is Ubuntu 12.04, so first I need to work out how to fix the
gdal installation on there.<br>
<blockquote><tt><b>zls@gs0:/mnt/geo_lvm0/gisdata/raster/orthos$</b>
gdalinfo --version</tt><tt><br>
</tt><tt>GDAL 1.9.1, released 2012/05/15</tt><tt><br>
</tt><tt><b>zls@gs0:/mnt/geo_lvm0/gisdata/raster/orthos$</b>
gdal_edit.py --version</tt><tt><br>
</tt><tt>Traceback (most recent call last):</tt><tt><br>
</tt><tt> File "/usr/bin/gdal_edit.py", line 33, in
<module></tt><tt><br>
</tt><tt> from osgeo import gdal</tt><tt><br>
</tt><tt> File
"/usr/lib/python2.6/dist-packages/osgeo/__init__.py", line 21,
in <module></tt><tt><br>
</tt><tt> _gdal = swig_import_helper()</tt><tt><br>
</tt><tt> File
"/usr/lib/python2.6/dist-packages/osgeo/__init__.py", line 17,
in swig_import_helper</tt><tt><br>
</tt><tt> _mod = imp.load_module('_gdal', fp, pathname,
description)</tt><tt><br>
</tt><tt>ImportError: /usr/local/lib/libgdal.so.1: undefined
symbol: GEOSSimplify</tt><tt><br>
</tt><b><tt>zls@gs0:/mnt/geo_lvm0/gisdata/raster/orthos$</tt></b><br>
</blockquote>
and:<br>
<blockquote><tt><b>root@gs0:/usr/share/proj#</b></tt><tt> apt-get
update | grep -i gis</tt><tt><br>
</tt><font color="#ff6600"><tt><big><b>Ign</b></big>
<a class="moz-txt-link-freetext" href="http://ppa.launchpad.net/ubuntugis/ubuntugis-unstable/ubuntu/">http://ppa.launchpad.net/ubuntugis/ubuntugis-unstable/ubuntu/</a>
lucid/main Translation-en_ZA</tt></font><tt><br>
</tt><tt><b>root@gs0:/usr/share/proj#</b></tt><tt> uname -a</tt><tt><br>
</tt><tt>Linux gs0 2.6.32-41-generic #94-Ubuntu SMP Fri Jul 6
18:00:34 UTC 2012 x86_64 GNU/Linux</tt><tt><br>
</tt><tt><b>root@gs0:/usr/share/proj#</b></tt><br>
</blockquote>
<br>
To get back to this thread topic, then "Bad" TIFF is:<br>
<blockquote><font color="#ff0000"><tt>zls@gs0:/mnt/geo_lvm0/gisdata/raster/orthos$
gdalinfo ngi_20141205/3121DA/3121DA_09_2011_407_RGB_RECT.TIF</tt><tt><br>
</tt><tt>Driver: GTiff/GeoTIFF</tt><tt><br>
</tt><tt>Files:
ngi_20141205/3121DA/3121DA_09_2011_407_RGB_RECT.TIF</tt><tt><br>
</tt><tt>
ngi_20141205/3121DA/3121DA_09_2011_407_RGB_RECT.TFW</tt><tt><br>
</tt><tt>Size is 10881, 11781</tt><tt><br>
</tt><tt>Coordinate System is:</tt><tt><br>
</tt><tt>LOCAL_CS["IMAGINE GeoTIFF Support ERDAS IMAGINE 2013
13.0.0.92 Geocoding information not available Projection Name
= Unknown Units = meters GeoTIFF Units = meters",</tt><tt><br>
</tt><tt> UNIT["metre",1,</tt><tt><br>
</tt><tt> AUTHORITY["EPSG","9001"]]]</tt><tt><br>
</tt><tt>Origin =
(61356.750000000000000,-3491979.750000000000000)</tt><tt><br>
</tt><tt>Pixel Size = (0.500000000000000,-0.500000000000000)</tt><tt><br>
</tt><tt>Metadata:</tt><tt><br>
</tt><tt> AREA_OR_POINT=Area</tt><tt><br>
</tt><tt> TIFFTAG_RESOLUTIONUNIT=2 (pixels/inch)</tt><tt><br>
</tt><tt> TIFFTAG_XRESOLUTION=1</tt><tt><br>
</tt><tt> TIFFTAG_YRESOLUTION=1</tt><tt><br>
</tt><tt>Image Structure Metadata:</tt><tt><br>
</tt><tt> COMPRESSION=YCbCr JPEG</tt><tt><br>
</tt><tt> INTERLEAVE=PIXEL</tt><tt><br>
</tt><tt> SOURCE_COLOR_SPACE=YCbCr</tt><tt><br>
</tt><tt>Corner Coordinates:</tt><tt><br>
</tt><tt>Upper Left ( 61356.750,-3491979.750) </tt><tt><br>
</tt><tt>Lower Left ( 61356.750,-3497870.250) </tt><tt><br>
</tt><tt>Upper Right ( 66797.250,-3491979.750) </tt><tt><br>
</tt><tt>Lower Right ( 66797.250,-3497870.250) </tt><tt><br>
</tt><tt>Center ( 64077.000,-3494925.000) </tt><tt><br>
</tt><tt>Band 1 Block=256x256 Type=Byte, ColorInterp=Red</tt><tt><br>
</tt><tt> Overviews: 5440x5890, 2720x2945, 1360x1472, 680x736,
340x368, 170x184, 85x92, 42x46, 21x23</tt><tt><br>
</tt><tt>Band 2 Block=256x256 Type=Byte, ColorInterp=Green</tt><tt><br>
</tt><tt> Overviews: 5440x5890, 2720x2945, 1360x1472, 680x736,
340x368, 170x184, 85x92, 42x46, 21x23</tt><tt><br>
</tt><tt>Band 3 Block=256x256 Type=Byte, ColorInterp=Blue</tt><tt><br>
</tt><tt> Overviews: 5440x5890, 2720x2945, 1360x1472, 680x736,
340x368, 170x184, 85x92, 42x46, 21x23</tt><tt><br>
</tt><tt>zls@gs0:/mnt/geo_lvm0/gisdata/raster/orthos$</tt></font><br>
</blockquote>
and the good version (tile next to this tile) is:<br>
<blockquote><font color="#009900"><tt>zls@gs0:/mnt/geo_lvm0/gisdata/raster/orthos$
gdalinfo ngi_20141205/3121DA/3121DA_10_2011_407_RGB_RECT.TIF</tt><tt><br>
</tt><tt>Driver: GTiff/GeoTIFF</tt><tt><br>
</tt><tt>Files:
ngi_20141205/3121DA/3121DA_10_2011_407_RGB_RECT.TIF</tt><tt><br>
</tt><tt>
ngi_20141205/3121DA/3121DA_10_2011_407_RGB_RECT.TFW</tt><tt><br>
</tt><tt>Size is 10881, 11781</tt><tt><br>
</tt><tt>Coordinate System is:</tt><tt><br>
</tt><tt>PROJCS["WG21",</tt><tt><br>
</tt><tt> GEOGCS["GCS_Hartebeesthoek_1994",</tt><tt><br>
</tt><tt> DATUM["Hartebeesthoek94",</tt><tt><br>
</tt><tt> SPHEROID["WGS_1984",6378137,298.257223563,</tt><tt><br>
</tt><tt> AUTHORITY["EPSG","7030"]],</tt><tt><br>
</tt><tt> AUTHORITY["EPSG","6148"]],</tt><tt><br>
</tt><tt> PRIMEM["Greenwich",0],</tt><tt><br>
</tt><tt> UNIT["degree",0.0174532925199433]],</tt><tt><br>
</tt><tt> PROJECTION["Transverse_Mercator"],</tt><tt><br>
</tt><tt> PARAMETER["latitude_of_origin",0],</tt><tt><br>
</tt><tt> PARAMETER["central_meridian",21],</tt><tt><br>
</tt><tt> PARAMETER["scale_factor",1],</tt><tt><br>
</tt><tt> PARAMETER["false_easting",0],</tt><tt><br>
</tt><tt> PARAMETER["false_northing",0],</tt><tt><br>
</tt><tt> UNIT["metre",1,</tt><tt><br>
</tt><tt> AUTHORITY["EPSG","9001"]]]</tt><tt><br>
</tt><tt>Origin =
(66102.750000000000000,-3492009.750000000000000)</tt><tt><br>
</tt><tt>Pixel Size = (0.500000000000000,-0.500000000000000)</tt><tt><br>
</tt><tt>Metadata:</tt><tt><br>
</tt><tt> AREA_OR_POINT=Area</tt><tt><br>
</tt><tt> TIFFTAG_RESOLUTIONUNIT=2 (pixels/inch)</tt><tt><br>
</tt><tt> TIFFTAG_XRESOLUTION=1</tt><tt><br>
</tt><tt> TIFFTAG_YRESOLUTION=1</tt><tt><br>
</tt><tt>Image Structure Metadata:</tt><tt><br>
</tt><tt> COMPRESSION=YCbCr JPEG</tt><tt><br>
</tt><tt> INTERLEAVE=PIXEL</tt><tt><br>
</tt><tt> SOURCE_COLOR_SPACE=YCbCr</tt><tt><br>
</tt><tt>Corner Coordinates:</tt><tt><br>
</tt><tt>Upper Left ( 66102.750,-3492009.750) (
21d41'46.15"E, 31d32'54.95"S)</tt><tt><br>
</tt><tt>Lower Left ( 66102.750,-3497900.250) (
21d41'47.58"E, 31d36' 6.19"S)</tt><tt><br>
</tt><tt>Upper Right ( 71543.250,-3492009.750) (
21d45'12.41"E, 31d32'53.78"S)</tt><tt><br>
</tt><tt>Lower Right ( 71543.250,-3497900.250) (
21d45'13.94"E, 31d36' 5.02"S)</tt><tt><br>
</tt><tt>Center ( 68823.000,-3494955.000) (
21d43'30.02"E, 31d34'30.00"S)</tt><tt><br>
</tt><tt>Band 1 Block=256x256 Type=Byte, ColorInterp=Red</tt><tt><br>
</tt><tt> Overviews: 5440x5890, 2720x2945, 1360x1472, 680x736,
340x368, 170x184, 85x92, 42x46, 21x23</tt><tt><br>
</tt><tt>Band 2 Block=256x256 Type=Byte, ColorInterp=Green</tt><tt><br>
</tt><tt> Overviews: 5440x5890, 2720x2945, 1360x1472, 680x736,
340x368, 170x184, 85x92, 42x46, 21x23</tt><tt><br>
</tt><tt>Band 3 Block=256x256 Type=Byte, ColorInterp=Blue</tt><tt><br>
</tt><tt> Overviews: 5440x5890, 2720x2945, 1360x1472, 680x736,
340x368, 170x184, 85x92, 42x46, 21x23</tt><tt><br>
</tt><tt>zls@gs0:/mnt/geo_lvm0/gisdata/raster/orthos$</tt></font><br>
</blockquote>
I am using the following (instead of gdal_edit) but was wondering if
my band pixels were being altered.<br>
<blockquote><tt>gdal_translate -a_srs +proj="tmerc +lat_0=0
+lon_0=19 +k=1 +x_0=0 +y_0=0 +axis=wsu +ellps=WGS84
+towgs84=0,0,0,0,0,0,0 +units=m +no_defs" -co "COMPRESS=JPEG"
-co "PHOTOMETRIC=YCBCR" 3121DA_09_2011_407_RGB_RECT.tif 3121da09.tif</tt><tt><br>
</tt></blockquote>
Then because the gdal_translate strips out the overviews:<br>
<blockquote><tt> gdaladdo --config COMPRESS_OVERVIEW JPEG --config
PHOTOMETRIC_OVERVIEW YCBCR --config INTERLEAVE_OVERVIEW PIXEL
3121da09.tif 2 4 8 16 32 64 128 256 512</tt><br>
</blockquote>
So, I was looking at a 1-step way of doing the above, ideally
without having to manually peek into an adjoining sheet to get the
correct proj.<br>
<b>This is what I am aiming at:</b><br>
I have about 40000 of these images, and I have written a BASH with
awk script to go through all the images and pull out certain info
to build a CSV file so that I can create attributed polygons to have
info about the underlying raster image. When this awk script fails
to find embedded proj info, it would be nice to make it peek into
the adjoining ortho, extract the relevant info, and edit it into the
'bad' ortho.<br>
<br>
Thanks again for your help.<br>
Kind regards,<br>
Zoltan<br>
<br>
<pre class="moz-signature" cols="72">--
===========================================
Zoltan Szecsei PrGISc [PGP0031]
Geograph (Pty) Ltd.
GIS and Photogrammetric Services
P.O. Box 7, Muizenberg 7950, South Africa.
Mobile: +27-83-6004028
Fax: +27-86-6115323 <a class="moz-txt-link-abbreviated" href="http://www.geograph.co.za">www.geograph.co.za</a>
===========================================</pre>
</body>
</html>