Subject: Re: [geometry] [Boost-users] please help; using buffer() extensions
From: Barend Gehrels (barend_at_[hidden])
Date: 2013-02-27 16:45:11
On 27-2-2013 22:13, John Lilley wrote:
> Thanks Barend! I think I am almost there, but there is a kink that I
> am trying to work out. If I have coordinates expressed in degrees
> longitude/latitude, can I operate directly on those coordinates
> without first transforming them to a "flat" projection like UTM? It
> is easy enough to get meters/degree latitude, but longitudinal
> distortion is another matter. Does the distance_strategy have
> anything to do with this? I can accept a first-order model that
> assumes meters/degree-longitude is constant over the entire shape.
Hi John, list,
As promised today, below the example. W.r.t. coordinates, the buffer
operation uses intersections etc internally, and they are not yet ported
to latlong. So you might use it but you will indeed get distortions
then. So yes, the best is to transform first to a cartesian system...
The distance_strategy cannot fix this.
A few changes has been committed today so please update if necessary.
I mentioned that negative buffers (for deflate) are possible - that is
currently not running, I will come back to this.
But it is possible to use assymetric buffers (on linestrings). As
join-strategies you can use "join_round" (like below) and "join_miter"
(with sharp corners).
// Complete example, using Boost.Geometry extension for buffer (not yet
released), buffering a polygon:
typedef boost::geometry::model::d2::point_xy<double> point_type;
typedef boost::geometry::model::polygon<point_type> polygon;
boost::geometry::read_wkt("POLYGON ((0 0,0 5,4 5,4 4,3 3,2 4,2
1,3 2,4 1,4 0,0 0))", my_polygon);
std::cout << "Input polygon, area: " <<
boost::geometry::area(my_polygon) << std::endl;
std::cout << "Output, area: " <<
boost::geometry::area(my_output) << std::endl;
The input / output (if converted to SVG) looks as below (green input,
Geometry list run by mateusz at loskot.net