[gdal-dev] (no subject)

Frank Warmerdam warmerdam at pobox.com
Tue Aug 11 09:46:01 EDT 2009


2009/8/10 Riki Tiki <mongoose_riki at mail.ru>:
>
>
> Hi All,
>
> I was trying to write a c# program to copy the existing raster file to a new raster file so that at the end i both files while displayed on tools like arcmap will be exactly the same... i started as follows
>
>
> string src_file = @"C:\raster1";
> Gdal.AllRegister();
> Dataset src_ds  = Gdal.Open(src_file, Access.GA_ReadOnly);
>
> Driver dr = Gdal.GetDriverByName("GTiff");
> string dest_file = @"C:\raster_copy";
> Dataset dest_ds = dr.Create(dest_file, src_ds.RasterXSize, src_ds.RasterYSize,
>                            1, DataType.GDT_Float32, null);
>
>
>
> now i do not know how to continue...? plz, can you help me?
>
> http://trac.osgeo.org/gdal/browser/trunk/gdal/swig/csharp/apps/GDALCreateCopy.cs
>
> i have already seen above one but that creates two different images when i open in arcmap.

Riki,

In order to do better than GDALCreateCopy.cs you will need to
analyse why the source and destination images are different
in arcmap.  Is it a georeferencing issues?  Pixel types?

What is the source image format?  Perhaps it is an
arc binary grid?  These can have auxilary information
that does not appear in formats like GeoTIFF.   It might
be helpful to use gdalinfo on the source and destination
and see if there are any apparent differences.

If you want to see how to do something similar to
CreateCopy() using Create and direct methods you
can look through the default implementation of CreateCopy.

  http://trac.osgeo.org/gdal/browser/trunk/gdal/gcore/gdaldriver.cpp#L334

Good luck,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent


More information about the gdal-dev mailing list