On 2014/12/15 12:53, Even Rouault wrote:
See http://www.gdal.org/gdal_edit.html

Hi Even,
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.

   *zls@gs0:/mnt/geo_lvm0/gisdata/raster/orthos$* gdalinfo --version
   GDAL 1.9.1, released 2012/05/15
   *zls@gs0:/mnt/geo_lvm0/gisdata/raster/orthos$* gdal_edit.py --version
   Traceback (most recent call last):
      File "/usr/bin/gdal_edit.py", line 33, in <module>
        from osgeo import gdal
      File "/usr/lib/python2.6/dist-packages/osgeo/__init__.py", line
   21, in <module>
        _gdal = swig_import_helper()
      File "/usr/lib/python2.6/dist-packages/osgeo/__init__.py", line
   17, in swig_import_helper
        _mod = imp.load_module('_gdal', fp, pathname, description)
   ImportError: /usr/local/lib/libgdal.so.1: undefined symbol: GEOSSimplify
   *zls@gs0:/mnt/geo_lvm0/gisdata/raster/orthos$*

and:

   *root@gs0:/usr/share/proj#*apt-get update | grep -i gis
   *Ign* http://ppa.launchpad.net/ubuntugis/ubuntugis-unstable/ubuntu/
   lucid/main Translation-en_ZA
   *root@gs0:/usr/share/proj#*uname -a
   Linux gs0 2.6.32-41-generic #94-Ubuntu SMP Fri Jul 6 18:00:34 UTC
   2012 x86_64 GNU/Linux
   *root@gs0:/usr/share/proj#*


To get back to this thread topic, then "Bad" TIFF is:

   zls@gs0:/mnt/geo_lvm0/gisdata/raster/orthos$ gdalinfo
   ngi_20141205/3121DA/3121DA_09_2011_407_RGB_RECT.TIF
   Driver: GTiff/GeoTIFF
   Files: ngi_20141205/3121DA/3121DA_09_2011_407_RGB_RECT.TIF
   ngi_20141205/3121DA/3121DA_09_2011_407_RGB_RECT.TFW
   Size is 10881, 11781
   Coordinate System is:
   LOCAL_CS["IMAGINE GeoTIFF Support ERDAS IMAGINE 2013 13.0.0.92
   Geocoding information not available Projection Name = Unknown Units
   = meters GeoTIFF Units = meters",
        UNIT["metre",1,
            AUTHORITY["EPSG","9001"]]]
   Origin = (61356.750000000000000,-3491979.750000000000000)
   Pixel Size = (0.500000000000000,-0.500000000000000)
   Metadata:
      AREA_OR_POINT=Area
      TIFFTAG_RESOLUTIONUNIT=2 (pixels/inch)
      TIFFTAG_XRESOLUTION=1
      TIFFTAG_YRESOLUTION=1
   Image Structure Metadata:
      COMPRESSION=YCbCr JPEG
      INTERLEAVE=PIXEL
      SOURCE_COLOR_SPACE=YCbCr
   Corner Coordinates:
   Upper Left  (   61356.750,-3491979.750)
   Lower Left  (   61356.750,-3497870.250)
   Upper Right (   66797.250,-3491979.750)
   Lower Right (   66797.250,-3497870.250)
   Center      (   64077.000,-3494925.000)
   Band 1 Block=256x256 Type=Byte, ColorInterp=Red
      Overviews: 5440x5890, 2720x2945, 1360x1472, 680x736, 340x368,
   170x184, 85x92, 42x46, 21x23
   Band 2 Block=256x256 Type=Byte, ColorInterp=Green
      Overviews: 5440x5890, 2720x2945, 1360x1472, 680x736, 340x368,
   170x184, 85x92, 42x46, 21x23
   Band 3 Block=256x256 Type=Byte, ColorInterp=Blue
      Overviews: 5440x5890, 2720x2945, 1360x1472, 680x736, 340x368,
   170x184, 85x92, 42x46, 21x23
   zls@gs0:/mnt/geo_lvm0/gisdata/raster/orthos$

and the good version (tile next to this tile) is:

   zls@gs0:/mnt/geo_lvm0/gisdata/raster/orthos$ gdalinfo
   ngi_20141205/3121DA/3121DA_10_2011_407_RGB_RECT.TIF
   Driver: GTiff/GeoTIFF
   Files: ngi_20141205/3121DA/3121DA_10_2011_407_RGB_RECT.TIF
   ngi_20141205/3121DA/3121DA_10_2011_407_RGB_RECT.TFW
   Size is 10881, 11781
   Coordinate System is:
   PROJCS["WG21",
        GEOGCS["GCS_Hartebeesthoek_1994",
            DATUM["Hartebeesthoek94",
                SPHEROID["WGS_1984",6378137,298.257223563,
                    AUTHORITY["EPSG","7030"]],
                AUTHORITY["EPSG","6148"]],
            PRIMEM["Greenwich",0],
            UNIT["degree",0.0174532925199433]],
        PROJECTION["Transverse_Mercator"],
        PARAMETER["latitude_of_origin",0],
        PARAMETER["central_meridian",21],
        PARAMETER["scale_factor",1],
        PARAMETER["false_easting",0],
        PARAMETER["false_northing",0],
        UNIT["metre",1,
            AUTHORITY["EPSG","9001"]]]
   Origin = (66102.750000000000000,-3492009.750000000000000)
   Pixel Size = (0.500000000000000,-0.500000000000000)
   Metadata:
      AREA_OR_POINT=Area
      TIFFTAG_RESOLUTIONUNIT=2 (pixels/inch)
      TIFFTAG_XRESOLUTION=1
      TIFFTAG_YRESOLUTION=1
   Image Structure Metadata:
      COMPRESSION=YCbCr JPEG
      INTERLEAVE=PIXEL
      SOURCE_COLOR_SPACE=YCbCr
   Corner Coordinates:
   Upper Left  (   66102.750,-3492009.750) ( 21d41'46.15"E, 31d32'54.95"S)
   Lower Left  (   66102.750,-3497900.250) ( 21d41'47.58"E, 31d36' 6.19"S)
   Upper Right (   71543.250,-3492009.750) ( 21d45'12.41"E, 31d32'53.78"S)
   Lower Right (   71543.250,-3497900.250) ( 21d45'13.94"E, 31d36' 5.02"S)
   Center      (   68823.000,-3494955.000) ( 21d43'30.02"E, 31d34'30.00"S)
   Band 1 Block=256x256 Type=Byte, ColorInterp=Red
      Overviews: 5440x5890, 2720x2945, 1360x1472, 680x736, 340x368,
   170x184, 85x92, 42x46, 21x23
   Band 2 Block=256x256 Type=Byte, ColorInterp=Green
      Overviews: 5440x5890, 2720x2945, 1360x1472, 680x736, 340x368,
   170x184, 85x92, 42x46, 21x23
   Band 3 Block=256x256 Type=Byte, ColorInterp=Blue
      Overviews: 5440x5890, 2720x2945, 1360x1472, 680x736, 340x368,
   170x184, 85x92, 42x46, 21x23
   zls@gs0:/mnt/geo_lvm0/gisdata/raster/orthos$

I am using the following (instead of gdal_edit) but was wondering if my band pixels were being altered.

   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

Then because the gdal_translate strips out the overviews:

     gdaladdo --config COMPRESS_OVERVIEW JPEG --config
   PHOTOMETRIC_OVERVIEW YCBCR --config INTERLEAVE_OVERVIEW PIXEL
   3121da09.tif 2 4 8 16 32 64 128 256 512

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.
*This is what I am aiming at:*
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.

Thanks again for your help.
Kind regards,
Zoltan

--

===========================================
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     www.geograph.co.za
===========================================

_______________________________________________
gdal-dev mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to