distance (with strategy)

| Home | Libraries | People | FAQ | More

##### distance (with strategy)

Calculate the distance of two geometries using the specified strategy.

###### Description

The free function area calculates the area of a geometry. using the specified strategy. Reasons to specify a strategy include: use another coordinate system for calculations; construct the strategy beforehand (e.g. with the radius of the Earth); select a strategy when there are more than one available for a calculation.

###### Synopsis

    template<typename Geometry1, typename Geometry2, typename Strategy>
    distance_result<Geometry1, Geometry2, Strategy>::type distance(Geometry1 const & geometry1, Geometry2 const & geometry2, Strategy const & strategy)

###### Parameters

Type | Concept | Name | Description
--- | --- | --- | ---
Geometry1 const & | Any type fulfilling a Geometry Concept | geometry1 | A model of the specified concept
Geometry2 const & | Any type fulfilling a Geometry Concept | geometry2 | A model of the specified concept
Strategy const & | Any type fulfilling a Distance Strategy Concept | strategy | The strategy which will be used for distance calculations

###### Returns

The calculated distance

###### Header

Either

`#include <boost/geometry.hpp>`

Or

`#include <boost/geometry/algorithms/distance.hpp>`

###### Available Strategies

- Pythagoras (cartesian)
- Haversine (spherical)
- Cross track (spherical, point-to-segment)
- Projected point (cartesian, point-to-segment)
- more (currently extensions): Vincenty, Andoyer (geographic)