[Gdal-dev] [OGR] Feature relationships
warmerdam at pobox.com
Tue Oct 25 12:18:04 EDT 2005
On 10/25/05, Andy Tompkins <atompkins at fastmail.fm> wrote:
> I was surprised when I couldn't find any inherent way to relate
> features to each other, and I am wondering if I have just missed
> something somewhere. I would also like to be able to share geometries
> (or parts of geometries) with different features, so that when I change
> a geometry (or part of a geometry) it is reflected in other geometries.
> For example, if my feature, f, is an ORGLineString, I would like to
> associate the two endpoints with features that are OGRPoints. In this
> way I would be able to construct a street network and traverse it going
> from feature to feature. I was looking for something like
> OGRLineString::StartPoint(OGRFeature *), (note not a OGRPoint as the
> parameter), and something like int OGRPoint::numLines(), and
> Another example are features that are ORGPolygon and I would like to
> have polygons that touch be associated to each other. In this way I
> would be able to create a polygon cover and move from polygon to
> Is this possible?
> How might I do this with OGR?
There is no concept of built-in feature relationships in
OGR. It takes a very "simple features" approach where
no feature has any inherent relationship to any other.
You can use attributes to encode some kinds of relationships
but it is entirely up to the application code to follow the rules or
update derived geometries.
Drivers like the Arc/Info Binary Coverages (AVCBin)
read topological datasets and represent the relationships
as attributes. For instance the PAL (polygon) features have
an ArcIds attribute with a list of arcs making up the polygon.
Likewise Arcs have a from/to node id, and a left/right
polygon id. But that is just a way of reflecting the underlying
topological dataset in that specific driver. That isn't generally
There are definately downsides to the current simple features
model, though the big upside is understandability and easy
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