3 // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
5 // This file was modified by Oracle on 2014-2017.
6 // Modifications copyright (c) 2014-2017 Oracle and/or its affiliates.
8 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
10 // Use, modification and distribution is subject to the Boost Software License,
11 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
12 // http://www.boost.org/LICENSE_1_0.txt)
14 #ifndef BOOST_GEOMETRY_STRATEGIES_GEOGRAPHIC_VINCENTY_HPP
15 #define BOOST_GEOMETRY_STRATEGIES_GEOGRAPHIC_VINCENTY_HPP
18 #include <boost/geometry/strategies/geographic/distance.hpp>
19 #include <boost/geometry/strategies/geographic/parameters.hpp>
22 namespace boost { namespace geometry
25 namespace strategy { namespace distance
29 \brief Distance calculation formulae on latlong coordinates, after Vincenty, 1975
31 \tparam Spheroid The reference spheroid model
32 \tparam CalculationType \tparam_calculation
34 - http://www.ngs.noaa.gov/PUBS_LIB/inverse.pdf
35 - http://www.icsm.gov.au/gda/gdav2.3.pdf
36 \author Adapted from various implementations to get it close to the original document
37 - http://www.movable-type.co.uk/scripts/LatLongVincenty.html
38 - http://exogen.case.edu/projects/geopy/source/geopy.distance.html
39 - http://futureboy.homeip.net/fsp/colorize.fsp?fileName=navigation.frink
44 typename Spheroid = srs::spheroid<double>,
45 typename CalculationType = void
48 : public strategy::distance::geographic
50 strategy::vincenty, Spheroid, CalculationType
53 typedef strategy::distance::geographic
55 strategy::vincenty, Spheroid, CalculationType
63 explicit inline vincenty(Spheroid const& spheroid)
68 #ifndef DOXYGEN_NO_STRATEGY_SPECIALIZATIONS
72 template <typename Spheroid, typename CalculationType>
73 struct tag<vincenty<Spheroid, CalculationType> >
75 typedef strategy_tag_distance_point_point type;
79 template <typename Spheroid, typename CalculationType, typename P1, typename P2>
80 struct return_type<vincenty<Spheroid, CalculationType>, P1, P2>
81 : vincenty<Spheroid, CalculationType>::template calculation_type<P1, P2>
85 template <typename Spheroid, typename CalculationType>
86 struct comparable_type<vincenty<Spheroid, CalculationType> >
88 typedef vincenty<Spheroid, CalculationType> type;
92 template <typename Spheroid, typename CalculationType>
93 struct get_comparable<vincenty<Spheroid, CalculationType> >
95 static inline vincenty<Spheroid, CalculationType> apply(vincenty<Spheroid, CalculationType> const& input)
101 template <typename Spheroid, typename CalculationType, typename P1, typename P2>
102 struct result_from_distance<vincenty<Spheroid, CalculationType>, P1, P2 >
104 template <typename T>
105 static inline typename return_type<vincenty<Spheroid, CalculationType>, P1, P2>::type
106 apply(vincenty<Spheroid, CalculationType> const& , T const& value)
113 } // namespace services
114 #endif // DOXYGEN_NO_STRATEGY_SPECIALIZATIONS
117 // We might add a vincenty-like strategy also for point-segment distance, but to calculate the projected point is not trivial
121 }} // namespace strategy::distance
124 }} // namespace boost::geometry
127 #endif // BOOST_GEOMETRY_STRATEGIES_GEOGRAPHIC_VINCENTY_HPP