[gdal-dev] Re: Handling nodata values

Even Rouault even.rouault at mines-paris.org
Sat Jun 26 07:04:10 EDT 2010


Nop,

val_repl.py wasn't copying georeferencing from input dataset to output 
dataset. I've just improved that now.

There's another existing script that you can use to copy georeferencing from 
an input dataset to an existing output dataset. The pixel data of the output 
dataset is left untouched. It's gdal_copyproj.py. Ex: python gdal_copyproj.py 
input.tif output.tif

Yo say 'gdalmerge quits with an error', but you didn't mention the exact error 
message nor the command line you've used, so it is hard to tell what's wrong

Le Saturday 26 June 2010 12:28:45 NopMap, vous avez écrit :
> Chaitanya kumar CH wrote:
> > In line 93 in val_repl.py, the default value is taken as of type Byte.
> > For a
> > quick fix, mention the data type of the raster reported by gdalinfo with
> > the
> > option -ot to the script. Refer to (
> > http://trac.osgeo.org/gdal/browser/trunk/gdal/swig/python/samples/val_rep
> >l.py#L61)
>
> Thanks, that was the reason. Now I got one step further, but it still does
> not work.
>
> The resulting TIF is now the same size as the original, but it appears that
> the georeferencing is lost in the process.
>
> The original file shows the folling information
> Size is 6001, 6001
> Coordinate System is:
> GEOGCS["WGS 84",
>     DATUM["WGS_1984",
>         SPHEROID["WGS 84",6378137,298.2572235630016,
>             AUTHORITY["EPSG","7030"]],
>         AUTHORITY["EPSG","6326"]],
>     PRIMEM["Greenwich",0],
>     UNIT["degree",0.0174532925199433],
>     AUTHORITY["EPSG","4326"]]
> Origin = (14.999583744947651,40.000416787708332)
> Pixel Size = (0.000833333333333,-0.000833333333333)
> Metadata:
>   AREA_OR_POINT=Area
> Image Structure Metadata:
>   INTERLEAVE=BAND
> Corner Coordinates:
> Upper Left  (  14.9995837,  40.0004168) ( 14d59'58.50"E, 40d 0'1.50"N)
> Lower Left  (  14.9995837,  34.9995835) ( 14d59'58.50"E, 34d59'58.50"N)
> Upper Right (  20.0004171,  40.0004168) ( 20d 0'1.50"E, 40d 0'1.50"N)
> Lower Right (  20.0004171,  34.9995835) ( 20d 0'1.50"E, 34d59'58.50"N)
> Center      (  17.5000004,  37.5000001) ( 17d30'0.00"E, 37d30'0.00"N)
> Band 1 Block=6001x1 Type=Int16, ColorInterp=Gray
>   NoData Value=-32768
>
> After processing with val_rpl.py, gdalmerge quits with an error and
> gdalinfo reports:
> Size is 6001, 6001
> Coordinate System is `'
> Image Structure Metadata:
>   INTERLEAVE=BAND
> Corner Coordinates:
> Upper Left  (    0.0,    0.0)
> Lower Left  (    0.0, 6001.0)
> Upper Right ( 6001.0,    0.0)
> Lower Right ( 6001.0, 6001.0)
> Center      ( 3000.5, 3000.5)
> Band 1 Block=6001x1 Type=Int16, ColorInterp=Gray
>
> What did I miss this time?
>
> Nop




More information about the gdal-dev mailing list