[Gdal-dev] GDALWarp API: units aren't transfered to the transformed dataset

Brian Marchand bmarchand at ara.com
Mon Apr 19 08:38:10 EDT 2004


Frank,

The changes you made definitely help. They keep me from having to
convert the data set to meters after the transform. The less I touch the
data the better.

Thanks for the fix!

Brian 

-----Original Message-----
From: gdal-dev-admin at remotesensing.org
[mailto:gdal-dev-admin at remotesensing.org] On Behalf Of Frank Warmerdam
Sent: Thursday, April 15, 2004 3:01 PM
To: gdal-dev at remotesensing.org
Subject: Re: [Gdal-dev] GDALWarp API: units aren't transfered to the
transformed dataset

Brian Marchand wrote:
> Hello,
> 
>  
> 
> I started using the GDAL warp API to re-project datasets. Certain 
> elevation grids such as SDTS files have elevation units in feet. This
is 
> correctly captured by the GetUnitType method of the GDALRasterBand 
> class. However, after the transform the new GDALRasterBand objects do 
> not have units set. Unless I'm doing something wrong, the units should

> be carried over or at least a SetUnitType method should be added. I'm 
> using the "MEM" driver as the destination dataset driver.

Brian,

You are correct, the logic for creating a new file in gdalwarp.cpp only
copies the color table over from the source. No effort is made to copy
metadata, or other auxilary information like the units type.  The
convenience function GDALCreateAndReprojectImage() does not even copy
the
color table.

Furthermore, the "special" data items UnitType, Offset and Scale do not
even
have set methods on the GDALRasterBand class, so you can't even copy
them
yourself.

I have modified the MEM and VRT drivers to have custom set methods for
these
items, and the CreateCopy() method on the VRT driver will now clone this
information from a source dataset and preserve it in the XML VRT file.

However, that doesn't really help you much.  I don't really have much
advice
other than that you will likely need to keep track of this stuff
yourself
by some means.   You can now manually copy UnitType to a MEM dataset if
you
include memdataset.h if that helps.

Best regards,

-- 
---------------------------------------+--------------------------------
------
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

_______________________________________________
Gdal-dev mailing list
Gdal-dev at remotesensing.org
http://remotesensing.org/mailman/listinfo/gdal-dev



More information about the Gdal-dev mailing list