[Gdal-dev] A conceptual question about inner join.

Frank Warmerdam warmerdam at pobox.com
Tue Sep 2 09:13:45 EDT 2003


Jean. wrote:
> I want to write a custom OGR driver to access data organized as follow
> (the storage is specific) :
> 
> 1- PointTable
> ID(as long) - Point (WKB) - Comment(As text)
> 
> 2- PathTable
> A Path is composed with PointTable.
> PathID(as long) - PointID(as long foreign key) - Comment(As text).
> 
> An OGRFeature with a geometry of type point is perfect for the first
> table. 
> However, the second table raises a problem. I don't know how to
> represent a join (Path-Point) with an OGR Feature.
> I'm not sure that the OpenGIS simple feature specification propose a way
> to represent this case. The Path Table contains a geometry through the
> PointTable and not itself through a column.
> 
> What is the best way to manipulate through OGR a feature composed with
> list of feature?

Jean,

First, I would stress that the OGR-SQL does not actually implement any of the
SF SQL extensions.  While that might be an interested direction it is not
one I have attempted yet.

Second, the current OGR SQL join support does not include a mechanism to
do anything with geometry from secondary tables.  It is assumed they are only
used to add extra attribute columns.

Of course, you could do the joining in application code.  If you dataset is
not too large for RAM, you can just read all the features, indexing them
appropriately and do the join yourself.  I have done this a number of times
in Python scripts to form polygon datasets from edge sets for instance.

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