[gdal-dev] Copying metadata - GDALGetMetadata returns nothing in UMN MapServer WCS

Frank Warmerdam warmerdam at pobox.com
Thu Jul 3 10:18:20 EDT 2008


Maarten Plieger wrote:
> Hi,
> Currently I am working on a driver which writes NetCDF4/NetCDF3, with a 
> lot of metadata. The idea is that metadata from the sourcefiles will be 
> available in the destination file, when using for example gdal_translate.
> I am wondering why I can't retrieve metadata in the CreateCopy function, 
> when I am using gdal in the WCS of UMN MapServer...
> I use this: papszMetadata = GDALGetMetadata( (GDALDataset *) poDS,"");
> This returns metadata when I use gdal_translate.
> The problem is that no metadata is returned when I use the driver in UMN 
> MapServer WCS.
> 
> I Guess it has something to do with mapserver creating a virtual layer, 
> somewhere loosing the the information. Maybe mapserver thinks that only 
> the raster data is necessary?

Maarten,

Yes, I believe this is the problem.  MapServer essentially renders into
a memory bitmap wraps this as a MEM dataset, and then writes to the output
format from that.  This loses all metadata except for the geolocation
(geotransform) which we recreate.

> I see this in my loggings of apache:
> GDAL: GDALDriver::Create(MEM,msSaveImageGDAL_temp,1440,720,1,Int16,(nil))
> 
> Please Help! What am I doing wrong? I guess there is a simple solution? 
> Or is it true that metadata is lost in mapserver...?

Generally, yes, that is what it means.

It is hard to know how to carry through metadata since a single WCS
layer could actually consist of many images.  If you wish to experiment
with this, I believe we would need a special way for mapwcs.c to pass
a template source dataset to msSaveImage() to use as a source of metadata
when writing (finally in msSaveImageGDAL()).

I have not pursued this angle because it is not entirely clear what
metadata it would be desirable to preserve, and because it is not "natural"
given the mapserver data flow model.

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    | President OSGeo, http://osgeo.org



More information about the gdal-dev mailing list