[gdal-dev] Virtual dataset - how to?

Frank Warmerdam warmerdam at p...
Fri Apr 19 15:47:32 EDT 2002


Joel Lawhead wrote:
> I've been having fun with GDAL 1.1.7 and Python 2.2.1 on Windows 2000. I 
> was wondering if anyone could give me an example or pointer to create a 
> virtual dataset for use with CreateCopy(). I realize Frank is working on 
> rewriting 'gdal_translate' to use virtual datasets and was wondering if 
> there were any examples out there in C or preferably Python. I'm 
> experimenting with creating jpegs from other gdal formats.
> 
> I haven't located any direct examples in the list archive, gdal example 
> sources or OpenEV sources. I'm aware of the two-step method to create a 
> JPEG by doing the resampling in another format but was just curious 
> about the virtual dataset concept. At first glance it seems like that 
> method might be faster. I haven't checked the UMN MapServer source code 
> to see whether it uses the two-step process or virtual datasets to 
> convert data to jpegs. If I've overlooked anything please let me know.

Joel,

As you note, once the rewrite of gdal_translate is done to utilize the
virtual datasets the two step process will not longer be needed but for
now it is. Currently there is no programatic way of creating virtual
datasets ... they have to be initialized from the XML .vrt files. The
closest you could get would be to write out a temporary .vrt file with
the description you want.

I had intended to do more today, but I have been distracted by a high
priority task, but what I have got done is add a CreateCopy() method
for VRTDataset. That means "gdal_translate -of VRT utm.tif utm.vrt"
will create a .vrt file that is an image (and still referring to) the
utm.tif file. This .vrt file can then be hand edited to modify some
information.

If you were working with very large files to translate to JPEG with
an altered configuration you could conveivably do:

gdal_translate -of VRT big.tif big.vrt
hand edit big.vrt to take the subset, band combinatoin etc desired.
gdal_translate -of JPG big.vrt big.jpg

But that isn't my intended final solution.

> I've been working with Perl for several years and Python for a couple of 
> years and in the last year have been introduced to the GIS/remote 
> sensing world. I started out trying to understand image manipulation 
> using the Python Imaging Library which lead me to GDAL. I've found GDAL 
> a great tool for learning about the different geo-spatial data formats. 
> 
> What would be really nice would be a GDAL Cookbook' on the Yahoo Groups 
> site. More experienced programmers could post their successful code 
> snippets (maybe in the 'Files' section?) which would make it easy to 
> find examples to give us intermediate programmers a little boost. I 
> found the API tutorial on the GDAL site extremely helpful and would love 
> to see more of those types of examples. Once I get comfortable with 
> GDAL in Python I'll try to write a comprehensive tutorial about what 
> I've learned.

I like the idea, but I am not sure I want to depend on Yahoo groups to hold
it all. I would like to even transition the mailing list off yahoo eventually
since their ads are getting increasingly annoying.

I have been impressed with the MapServer Wiki, and I am wondering if we
should establish something similar for GDAL on remotesensing.org. In
the meantime we could likely colonize a corner of the MapServer Wiki with
GDAL related information. The MapServer Wiki is at:

http://mapserver.gis.umn.edu/cgi-bin/wiki.pl

I also agree with the need for more and better tutorial material of various kinds.
I would be happy to incorporate submissions from GDAL users.

Best regards,

-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up | Frank Warmerdam, warmerdam at p...
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