[gdal-dev] OGR VRT Schema Support

Frank Warmerdam warmerdam at pobox.com
Fri Oct 30 04:18:39 EDT 2009


Folks,

I have done a bit of work around OGR recently to make it easier to manage
schemas for layers as VRT files.  For a project I wanted to be able to
have a VRT file which would define a set of layers with geometry types,
coordinate systems, fields and related information that I could use
with ogr2ogr or similar utilities to create all the layers.

To that end I have:

  o Extended the VRT driver to support <Field> definitions giving all
    the details of an attribute field on a layer (type, width, name, precision
    and the source field it comes from in the source layer).

  o Written an ogr2vrt.py script that will create a VRT corresponding to a
    source datasource.  This is the ogr equivelent to what we could do with
    gdal_translate -of VRT in.tif out.vrt but for feature datasources.  The
    script currently lives in gdal/swig/python/samples but I may promote it
    to the scripts directory implying it is supported if it is deemed to be
    useful.

  o Modified the VRT driver so that if the datasource name is @dummy@ it will
    not go looking for an external file - it just creates a dummy memory
    datasource and layer.  This effectively turns the .vrt into a schema
    definition since there will be no effort to go looking for features on
    the layers.  The -schema switch to ogr2vrt.py will create a VRT setup
    this way.

Let me know if there are any questions or interest in this capability.

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



More information about the gdal-dev mailing list