Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

PrevUpHomeNext

strategy::buffer::geographic_point_circle

Create a circular buffer around a point, on the Earth.

Description

This strategy can be used as PointStrategy for the buffer algorithm. It creates a circular buffer around a point, on the Earth. It can be applied for points and multi_points.

Synopsis

template<typename FormulaPolicy, typename Spheroid, typename CalculationType>
class strategy::buffer::geographic_point_circle
{
  // ...
};

Template parameter(s)

Parameter

Default

Description

typename FormulaPolicy

strategy::andoyer

typename Spheroid

srs::spheroid<double>

typename CalculationType

void

Constructor(s)

Function

Description

Parameters

geographic_point_circle(std::size_t count = 90)

Constructs the strategy.

std::size_t: count: number of points for the created circle (if count is smaller than 3, count is internally set to 3)

Header

#include <boost/geometry/strategies/geographic/buffer_point_circle.hpp>

Example

Shows how the point_circle strategy, for the Earth, can be used as a PointStrategy to create circular buffers around points

#include <boost/geometry.hpp>
#include <iostream>

int main()
{
    namespace bg = boost::geometry;

    typedef bg::model::point<double, 2, bg::cs::geographic<bg::degree> > point;

    // Declare the geographic_point_circle strategy (with 36 points)
    // Default template arguments (taking Andoyer strategy)
    bg::strategy::buffer::geographic_point_circle<> point_strategy(36);

    // Declare the distance strategy (one kilometer, around the point, on Earth)
    bg::strategy::buffer::distance_symmetric<double> distance_strategy(1000.0);

    // Declare other necessary strategies, unused for point
    bg::strategy::buffer::join_round join_strategy;
    bg::strategy::buffer::end_round end_strategy;
    bg::strategy::buffer::side_straight side_strategy;

    // Declare/fill a point on Earth, near Amsterdam
    point p;
    bg::read_wkt("POINT(4.9 52.1)", p);

    // Create the buffer of a point on the Earth
    bg::model::multi_polygon<bg::model::polygon<point> > result;
    bg::buffer(p, result,
                distance_strategy, side_strategy,
                join_strategy, end_strategy, point_strategy);

    std::cout << "Area: " << bg::area(result) / (1000 * 1000) << " square kilometer" << std::endl;

    return 0;
}

Output:

Area: 3.12542 square kilometer
See also

PrevUpHomeNext