|
Geometry : |
Subject: [ggl] Adding support for Curves (and other custom geometry types)
From: Barend Gehrels (barend)
Date: 2011-07-15 06:06:21
Hi Mats,
> I'm very interested in using Boost.Geometry in my project, as it looks
> like a better fit than GEOS.
>
> In GEOS I need to extract the geometry from my internal geometry
> object/class, and create new geos::geom::Geometry objects, while
> Boost.Geometry -- if I have read the docs correctly -- allows me to
> define my internal geometry object as Boost.Geometry compatible (with
> BOOST_GEOMETRY_REGISTER_*), and get all of the Boost.Geometry
> functionality "for free" directly against my internal geometry
> objects/classes, thus eliminating the additional object I have to
> create with GEOS. Is this correct?
>
Yes, this is correct.
> In addition to the existing Geometry models in Boost.Geometry, I need
> support for Curves (CIRCULARSTRINGs in PostGIS [1]), which are
> basically a start, end and middle point (PostGIS takes care of
> calculating the actual arc).
>
> At the moment, I only need support for writing the Curve to EWKT (a
> PostGIS extension to WKT. Currently, EWKT is a superset of WKT.).
> Could you give me pointers on how to achieve this (i.e. defining a
> Curve Geometry model, and extending the io.wkt module to add some EWKT
> features)?
>
That is not trivial. But it should be doable. We do not yet support
curves indeed. We do have circles and spheres but they are moved to an
extension, because we first want to concentrate on linear features. And
in that extension, WKT is not supported.
What you would need to do to support it (more or less the official way):
1) define a tag (e.g. "circularstring_tag"), comparable to linestring_tag
2) create a concept (so for circular string it would probably be similar
to a linestring). A concept is a set of traits classes, plus a concept
checking class
3) create a model, or adapt your existing geometries to this concept
4) in write_wkt.hpp, add a dispatch for the tag, and implement the WKT
writing.
You might postpone a step (e.g. the concept checking class). Anyway,
because it is more or less comparable to a linestring implementation,
you can look how these steps are done there.
I'm interested in the results!
Regards, Barend
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/ggl/attachments/20110714/9871ccf4/attachment.html
Geometry list run by mateusz at loskot.net