Boost logo

Geometry :

Subject: [ggl] A few Boost.Geometry questions
From: Bill Zissimopoulos (ggl)
Date: 2010-09-20 19:41:24


Hello, list:

I am evaluating Boost.Geometry for use with our project, which requires operations on geometries. We currently use GEOS for this purpose, but GEOS has multiple robustness problems, is slow and it requires translation between our data structures and those of GEOS.

I am intrigued by the promise of Boost.Geometry that it can potentially act upon our data structures directly and that robustness issues can be eliminated by the use of high precision arithmetic libraries.

Our geometries are C arrays of the following structure:
        struct GeometryPath
        {
            char tag;
            size_t npoints;
            Point *points;
            Float *zvalues;
        };
GeometryPath.tag can take one of the following values:
        'P': multi-point
        '3': multi-point w/ associated z-values (e.g. altitudes, depths)
        'L': linestring
        'A': area (exterior polygon ring)
        'H': hole (interior polygon ring)

Based on these definitions it can be seen that our geometries (being arrays of GeometryPath) can simultaneously contain multiple points, line strings and polygons. I would like to use the Boost.Geometry algorithms to manipulate our geometries. I can obviously simply copy our data structures to Boost.Geometry data structures such as boost::geometry::polygon, etc, but this defeats one of the main reasons to use Boost.Geometry in the first place.

I am therefore looking to find the best way to translate our data structures to constructs that Boost.Geometry can understand and act upon. Some of them are (somewhat) obvious:
        BOOST_GEOMETRY_REGISTER_POINT_2D(Point, Float, cs::geographic<degree>, x, y)
                // but notice that we lose the optional zvalue present only when tag=='3'
        BOOST_GEOMETRY_REGISTER_BOX(Rect, Point, origin, extent)

Others not as much. For example, how do I (minimally) translate a pair of arguments
        GeometryPath *p, size_t n
into a bunch of constructs that Boost can act upon? I think I understand the idea of concepts, but Boost does not seem to have a concept for a geometry that can simultaneously contain multiple points, multiple line strings and multiple polygons.

Any pointers will be very appreciated. Boost.Geometry looks like a great library, but the documentation at this point seems somewhat impenetrable.

Bill

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/ggl/attachments/20100920/4e7e7cb9/attachment.html


Geometry list run by mateusz at loskot.net