[Gdal-dev] OGR Virtual Layers

Frank Warmerdam warmerdam at pobox.com
Mon Nov 3 12:46:31 EST 2003


Folks,

For a contract I have, I need to implement "Virtual OGR Datasources".  The
primary goal in this case is to allow a virtual OGR data source to use
an existing driver (such as the ODBC driver, or Oracle driver) to read
non-spatial tables, and select columns to use as X, and Y to return a
"spatial points" layer to an OGR application.

However, at the same time I am thinking about other things I would like
to accomplish with such a virtual datasource concept.

So far I have:
  * Assigning a coordinate system. (required)
  * Constructing geometry from x/y columns. (required)
  * Constructing geometry from WKT or WKB columns.
  * Using geometry directly from the source.
  * renaming, or subsetting columns list.
  * Assigning a layer geometry type.
  * Altering column types (string to int for instance), or precision information.
  * treating an SQL query on the source datasource as a table in the virtual layer.
  * memory or disk based caching.
  * virtual files should be openable from disk based XML config file, or an in memory
    XML definition.
  * pass through SetFeature and CreateFeature.
  * A method to create a virtual datasource cloning a real datasource.  This could
    then be hand edited to make minor changes in configuration.
  * The ability to control whether attribute and/or spatial queries are "passed
    through".

I am imagining virtual datasources being controlled by an XML configuration
file that might look something like this:

<OGR_VirtualDatabase>

     <OGR_VirtualLayer name="RootWormReports">

         <SourceDatasource>ODBC:guest/anonymous at agcan_main</SourceDatasource>
  	<SourceLayer>RootWormReports</SourceLayer>
	<GeometryType>Point</GeometryType>
	<GeometryField encoding="xy" x="ReportLong" y="ReportLat"/>
	<LayerSRS>GEOGCS...</LayerSRS>
     </OGR_VirtualLayer>

</OGR_VirtualDatabase>

In general, the idea is that the virtual datasource provides an opportunity to
"fix up" lots of things that aren't easily done within individual format
drivers.

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