$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r66828 - in sandbox/geometry: boost/geometry/extensions/gis/geographic/strategies boost/geometry/extensions/gis/latlong boost/geometry/strategies/spherical boost/geometry/views libs/geometry/example/extensions/gis/latlong libs/geometry/example/with_external_libs libs/geometry/example/with_external_libs/contrib/shapelib-1.3.0b2 libs/geometry/test/extensions/gis/latlong libs/geometry/test/extensions/gis/projections libs/geometry/test/strategies
From: barend.gehrels_at_[hidden]
Date: 2010-11-28 16:49:51
Author: barendgehrels
Date: 2010-11-28 16:49:46 EST (Sun, 28 Nov 2010)
New Revision: 66828
URL: http://svn.boost.org/trac/boost/changeset/66828
Log:
Fixed point-segment default_strategy construct
Fixed cross track for latlong (partly)
Added:
   sandbox/geometry/boost/geometry/extensions/gis/geographic/strategies/distance_cross_track.hpp   (contents, props changed)
   sandbox/geometry/boost/geometry/views/
   sandbox/geometry/boost/geometry/views/enveloped_view.hpp   (contents, props changed)
   sandbox/geometry/boost/geometry/views/section_view.hpp   (contents, props changed)
   sandbox/geometry/libs/geometry/example/with_external_libs/contrib/shapelib-1.3.0b2/boost_geometry_readme.txt
      - copied unchanged from r66816, /sandbox/geometry/libs/geometry/example/with_external_libs/contrib/shapelib-1.3.0b2/readme.txt
   sandbox/geometry/libs/geometry/test/extensions/gis/latlong/cross_track.cpp   (contents, props changed)
   sandbox/geometry/libs/geometry/test/extensions/gis/latlong/cross_track.vcproj   (contents, props changed)
Removed:
   sandbox/geometry/libs/geometry/example/with_external_libs/contrib/shapelib-1.3.0b2/readme.txt
   sandbox/geometry/libs/geometry/example/with_external_libs/x02_numeric_adaptor_example.cpp
   sandbox/geometry/libs/geometry/example/with_external_libs/x02_numeric_adaptor_example.sln
   sandbox/geometry/libs/geometry/example/with_external_libs/x02_numeric_adaptor_example.vcproj
Text files modified: 
   sandbox/geometry/boost/geometry/extensions/gis/geographic/strategies/andoyer.hpp   |     5 ++                                      
   sandbox/geometry/boost/geometry/extensions/gis/latlong/latlong.hpp                 |     3                                         
   sandbox/geometry/boost/geometry/strategies/spherical/distance_cross_track.hpp      |    66 +++++++++++++++++++++--------           
   sandbox/geometry/libs/geometry/example/extensions/gis/latlong/distance_example.cpp |    88 +++++++++++++++++++++++++---------------
   sandbox/geometry/libs/geometry/test/extensions/gis/latlong/Jamfile.v2              |     1                                         
   sandbox/geometry/libs/geometry/test/extensions/gis/latlong/andoyer.cpp             |     9 ++++                                    
   sandbox/geometry/libs/geometry/test/extensions/gis/latlong/latlong.sln             |     6 ++                                      
   sandbox/geometry/libs/geometry/test/extensions/gis/projections/projections.cpp     |     5 +                                       
   sandbox/geometry/libs/geometry/test/strategies/cross_track.cpp                     |    60 ++++++++++++++++++---------             
   9 files changed, 169 insertions(+), 74 deletions(-)
Modified: sandbox/geometry/boost/geometry/extensions/gis/geographic/strategies/andoyer.hpp
==============================================================================
--- sandbox/geometry/boost/geometry/extensions/gis/geographic/strategies/andoyer.hpp	(original)
+++ sandbox/geometry/boost/geometry/extensions/gis/geographic/strategies/andoyer.hpp	2010-11-28 16:49:46 EST (Sun, 28 Nov 2010)
@@ -85,6 +85,11 @@
             return m_ellipsoid;
         }
 
+        inline calculation_type radius() const
+        {
+            return m_ellipsoid.a();
+        }
+
 
     private :
         geometry::detail::ellipsoid<calculation_type> m_ellipsoid;
Added: sandbox/geometry/boost/geometry/extensions/gis/geographic/strategies/distance_cross_track.hpp
==============================================================================
--- (empty file)
+++ sandbox/geometry/boost/geometry/extensions/gis/geographic/strategies/distance_cross_track.hpp	2010-11-28 16:49:46 EST (Sun, 28 Nov 2010)
@@ -0,0 +1,72 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+//
+// Copyright Barend Gehrels 2007-2009, Geodan, Amsterdam, the Netherlands.
+// Copyright Bruno Lalande 2008, 2009
+// Use, modification and distribution is subject to the Boost Software License,
+// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_GEOMETRY_EXTENSIONS_STRATEGIES_GEOGRAPHIC_DISTANCE_CROSS_TRACK_HPP
+#define BOOST_GEOMETRY_EXTENSIONS_STRATEGIES_GEOGRAPHIC_DISTANCE_CROSS_TRACK_HPP
+
+
+#include <boost/concept_check.hpp>
+#include <boost/mpl/if.hpp>
+#include <boost/type_traits.hpp>
+
+
+#include <boost/geometry/strategies/spherical/distance_cross_track.hpp>
+
+
+
+#ifndef DOXYGEN_NO_STRATEGY_SPECIALIZATIONS
+namespace boost { namespace geometry
+{
+
+namespace strategy { namespace distance
+{
+
+namespace services
+{
+
+
+template <typename Point, typename PointOfSegment, typename Strategy>
+struct default_strategy<segment_tag, Point, PointOfSegment, geographic_tag, geographic_tag, Strategy>
+{
+    typedef cross_track
+        <
+            Point,
+            PointOfSegment,
+            void,
+            typename boost::mpl::if_
+                <
+                    boost::is_void<Strategy>,
+                    typename default_strategy
+                        <
+                            point_tag, Point, PointOfSegment,
+                            geographic_tag, geographic_tag
+                        >::type,
+                    Strategy
+                >::type
+        > type;
+};
+
+
+
+} // namespace services
+#endif // DOXYGEN_NO_STRATEGY_SPECIALIZATIONS
+
+
+}} // namespace strategy::distance
+
+
+#ifndef DOXYGEN_NO_STRATEGY_SPECIALIZATIONS
+
+
+#endif
+
+
+}} // namespace boost::geometry
+
+
+#endif // BOOST_GEOMETRY_EXTENSIONS_STRATEGIES_GEOGRAPHIC_DISTANCE_CROSS_TRACK_HPP
Modified: sandbox/geometry/boost/geometry/extensions/gis/latlong/latlong.hpp
==============================================================================
--- sandbox/geometry/boost/geometry/extensions/gis/latlong/latlong.hpp	(original)
+++ sandbox/geometry/boost/geometry/extensions/gis/latlong/latlong.hpp	2010-11-28 16:49:46 EST (Sun, 28 Nov 2010)
@@ -9,7 +9,7 @@
 #ifndef BOOST_GEOMETRY_LATLONG_HPP
 #define BOOST_GEOMETRY_LATLONG_HPP
 
-// Predeclare common Cartesian 3D points for convenience
+// Predeclare common latlong points for convenience
 
 #include <boost/geometry/geometries/geometries.hpp>
 #include <boost/geometry/extensions/gis/latlong/point_ll.hpp>
@@ -17,6 +17,7 @@
 
 #include <boost/geometry/extensions/gis/geographic/strategies/andoyer.hpp>
 #include <boost/geometry/extensions/gis/geographic/strategies/vincenty.hpp>
+#include <boost/geometry/extensions/gis/geographic/strategies/distance_cross_track.hpp>
 
 namespace boost { namespace geometry
 {
Modified: sandbox/geometry/boost/geometry/strategies/spherical/distance_cross_track.hpp
==============================================================================
--- sandbox/geometry/boost/geometry/strategies/spherical/distance_cross_track.hpp	(original)
+++ sandbox/geometry/boost/geometry/strategies/spherical/distance_cross_track.hpp	2010-11-28 16:49:46 EST (Sun, 28 Nov 2010)
@@ -9,8 +9,10 @@
 #ifndef BOOST_GEOMETRY_STRATEGIES_SPHERICAL_DISTANCE_CROSS_TRACK_HPP
 #define BOOST_GEOMETRY_STRATEGIES_SPHERICAL_DISTANCE_CROSS_TRACK_HPP
 
-#include <boost/concept/requires.hpp>
 
+#include <boost/concept_check.hpp>
+#include <boost/mpl/if.hpp>
+#include <boost/type_traits.hpp>
 
 #include <boost/geometry/core/cs.hpp>
 #include <boost/geometry/core/access.hpp>
@@ -23,7 +25,11 @@
 #include <boost/geometry/util/promote_floating_point.hpp>
 #include <boost/geometry/util/math.hpp>
 
-//#include <boost/geometry/util/write_dsv.hpp>
+//#define BOOST_GEOMETRY_DEBUG_CROSS_TRACK
+#ifdef BOOST_GEOMETRY_DEBUG_CROSS_TRACK
+#  include <boost/geometry/util/write_dsv.hpp>
+#endif
+
 
 
 namespace boost { namespace geometry
@@ -60,11 +66,23 @@
                 >::type
         >::type return_type;
 
-    inline cross_track(return_type const& r = 1.0)
+    inline cross_track()
+    {
+        m_strategy = Strategy();
+        m_radius = m_strategy.radius();
+    }
+
+    inline cross_track(return_type const& r)
         : m_radius(r)
-        , m_strategy(1.0) // Keep this 1.0 and not r
+        , m_strategy(r)
     {}
 
+    inline cross_track(Strategy const& s)
+        : m_strategy(s)
+    {
+        m_radius = m_strategy.radius();
+    }
+
 
     // It might be useful in the future
     // to overload constructor with strategy info.
@@ -82,15 +100,17 @@
 
         return_type crs_AD = course(sp1, p);
         return_type crs_AB = course(sp1, sp2);
-        return_type XTD = geometry::math::abs(asin(sin(d1) * sin(crs_AD - crs_AB)));
+        return_type XTD = m_radius * geometry::math::abs(asin(sin(d1 / m_radius) * sin(crs_AD - crs_AB)));
 
-//std::cout << "Course " << dsv(sp1) << " to " << dsv(p) << " " << crs_AD * geometry::math::r2d << std::endl;
-//std::cout << "Course " << dsv(sp1) << " to " << dsv(sp2) << " " << crs_AB * geometry::math::r2d << std::endl;
-//std::cout << "XTD: " << (XTD * 6373.0) << " d1: " <<  (d1 * 6373.0)  << " d2: " <<  (d2 * 6373.0)  << std::endl;
+#ifdef BOOST_GEOMETRY_DEBUG_CROSS_TRACK
+std::cout << "Course " << dsv(sp1) << " to " << dsv(p) << " " << crs_AD * geometry::math::r2d << std::endl;
+std::cout << "Course " << dsv(sp1) << " to " << dsv(sp2) << " " << crs_AB * geometry::math::r2d << std::endl;
+std::cout << "XTD: " << XTD << " d1: " <<  d1  << " d2: " <<  d2  << std::endl;
+#endif
 
 
         // Return shortest distance, either to projected point on segment sp1-sp2, or to sp1, or to sp2
-        return return_type(m_radius * (std::min)((std::min)(d1, d2), XTD));
+        return return_type((std::min)((std::min)(d1, d2), XTD));
     }
 
     inline return_type radius() const { return m_radius; }
@@ -229,18 +249,26 @@
 
 
 
-template <typename Point, typename PointOfSegment>
-struct default_strategy<segment_tag, Point, PointOfSegment, spherical_tag, spherical_tag>
-{
-    typedef cross_track<Point, PointOfSegment> type;
-};
-
 
-// Use this point-segment for geographic as well. TODO: change this, extension!
-template <typename Point, typename PointOfSegment>
-struct default_strategy<segment_tag, Point, PointOfSegment, geographic_tag, geographic_tag>
+template <typename Point, typename PointOfSegment, typename Strategy>
+struct default_strategy<segment_tag, Point, PointOfSegment, spherical_tag, spherical_tag, Strategy>
 {
-    typedef cross_track<Point, PointOfSegment> type;
+    typedef cross_track
+        <
+            Point,
+            PointOfSegment,
+            void,
+            typename boost::mpl::if_
+                <
+                    boost::is_void<Strategy>,
+                    typename default_strategy
+                        <
+                            point_tag, Point, PointOfSegment,
+                            spherical_tag, spherical_tag
+                        >::type,
+                    Strategy
+                >::type
+        > type;
 };
 
 
Added: sandbox/geometry/boost/geometry/views/enveloped_view.hpp
==============================================================================
--- (empty file)
+++ sandbox/geometry/boost/geometry/views/enveloped_view.hpp	2010-11-28 16:49:46 EST (Sun, 28 Nov 2010)
@@ -0,0 +1,118 @@
+// Boost.Range (aka GGL, Generic Range Library)
+//
+// Copyright Barend Gehrels 2010, Geodan, Amsterdam, the Netherlands.
+// Use, modification and distribution is subject to the Boost Software License,
+// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_GEOMETRY_VIEWS_ENVELOPED_VIEW_HPP
+#define BOOST_GEOMETRY_VIEWS_ENVELOPED_VIEW_HPP
+
+
+#include <boost/mpl/if.hpp>
+#include <boost/range.hpp>
+
+#include <boost/geometry/core/ring_type.hpp>
+#include <boost/geometry/algorithms/detail/sections/get_section.hpp>
+
+
+namespace boost { namespace geometry
+{
+
+
+
+
+template <typename Range, typename Box, std::size_t Dimension>
+class enveloped_view
+{
+public :
+    typedef typename boost::range_iterator<Range const>::type const_iterator;
+    typedef typename boost::range_iterator<Range>::type iterator;
+
+    explicit enveloped_view(Range& range, Box const& box, int dir)
+        : m_begin(boost::begin(range))
+        , m_end(boost::end(range))
+    {
+        find_first(dir, m_begin, m_end, box);
+        find_last(dir, m_begin, m_end, box);
+
+        // Assignment of const iterator to iterator seems no problem,
+        // at least not for MSVC and GCC
+        m_const_begin = m_begin;
+        m_const_end = m_end;
+        // Otherwise: repeat
+        //find_first(dir, m_const_begin, m_const_end);
+        //find_last(dir, m_const_begin, m_const_end);
+    }
+
+    const_iterator begin() const { return m_const_begin; }
+    const_iterator end() const { return m_const_end; }
+
+    iterator begin() { return m_begin; }
+    iterator end() { return m_end; }
+
+private :
+    const_iterator m_const_begin, m_const_end;
+    iterator m_begin, m_end;
+
+    template <typename Point>
+    inline bool preceding(short int dir, Point const& point, Box const& box)
+    {
+        return (dir == 1  && get<Dimension>(point) < get<0, Dimension>(box))
+            || (dir == -1 && get<Dimension>(point) > get<1, Dimension>(box));
+    }
+
+    template <typename Point>
+    inline bool exceeding(short int dir, Point const& point, Box const& box)
+    {
+        return (dir == 1  && get<Dimension>(point) > get<1, Dimension>(box))
+            || (dir == -1 && get<Dimension>(point) < get<0, Dimension>(box));
+    }
+
+    template <typename Iterator>
+    void find_first(int dir, Iterator& begin, Iterator const end, Box const& box)
+    {
+        if (begin != end)
+        {
+            if (exceeding(dir, *begin, box))
+            {
+                // First obvious check
+                begin = end;
+                return;
+            }
+
+            iterator it = begin;
+            iterator prev = it++;
+            for(; it != end && preceding(dir, *it, box); ++it, ++prev) {}
+            begin = prev;
+        }
+    }
+
+    template <typename Iterator>
+    void find_last(int dir, Iterator& begin, Iterator& end, Box const& box)
+    {
+        if (begin != end)
+        {
+            iterator it = begin;
+            iterator prev = it++; 
+            for(; it != end && ! exceeding(dir, *prev, box); ++it, ++prev) {}
+            if (it == end && prev != end && preceding(dir, *prev, box))
+            {
+                // Last obvious check (not done before to not refer to *(end-1))
+                begin = end;
+            }
+            else
+            {
+                end = it;
+            }
+        }
+    }
+
+};
+
+
+
+}} // namespace boost::geometry
+
+
+#endif // BOOST_GEOMETRY_VIEWS_ENVELOPED_VIEW_HPP
Added: sandbox/geometry/boost/geometry/views/section_view.hpp
==============================================================================
--- (empty file)
+++ sandbox/geometry/boost/geometry/views/section_view.hpp	2010-11-28 16:49:46 EST (Sun, 28 Nov 2010)
@@ -0,0 +1,65 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+//
+// Copyright Barend Gehrels 2010, Geodan, Amsterdam, the Netherlands.
+// Use, modification and distribution is subject to the Boost Software License,
+// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_GEOMETRY_VIEWS_SECTION_VIEW_HPP
+#define BOOST_GEOMETRY_VIEWS_SECTION_VIEW_HPP
+
+
+#include <boost/range.hpp>
+
+#include <boost/geometry/core/ring_type.hpp>
+#include <boost/geometry/algorithms/detail/sections/get_section.hpp>
+#include <boost/geometry/util/add_const_if_c.hpp>
+
+
+namespace boost { namespace geometry
+{
+
+
+template <typename Geometry, typename Section>
+class section_view
+{
+    typedef typename geometry::range_type<Geometry>::type range_type;
+public :
+    typedef typename boost::range_iterator
+        <
+            range_type
+        >::type iterator;
+    typedef typename boost::range_iterator
+        <
+            range_type const
+        >::type const_iterator;
+
+    explicit section_view(Geometry& geometry, Section const& section)
+    {
+        get_section(geometry, section, m_begin, m_end);
+    }
+
+    const_iterator begin() const { return m_begin; }
+    const_iterator end() const { return m_end; }
+    iterator begin() { return m_begin; }
+    iterator end() { return m_end; }
+
+private :
+    typedef typename boost::range_iterator
+        <
+            typename add_const_if_c
+                <
+                    boost::is_const<Geometry>::value,
+                    range_type
+                >::type
+        >::type iterator_type;
+
+    iterator_type m_begin, m_end;
+};
+
+
+
+}} // namespace boost::geometry
+
+
+#endif // BOOST_GEOMETRY_VIEWS_SECTION_VIEW_HPP
Modified: sandbox/geometry/libs/geometry/example/extensions/gis/latlong/distance_example.cpp
==============================================================================
--- sandbox/geometry/libs/geometry/example/extensions/gis/latlong/distance_example.cpp	(original)
+++ sandbox/geometry/libs/geometry/example/extensions/gis/latlong/distance_example.cpp	2010-11-28 16:49:46 EST (Sun, 28 Nov 2010)
@@ -18,38 +18,61 @@
 #include <boost/geometry/geometries/cartesian2d.hpp>
 
 #include <boost/geometry/extensions/gis/latlong/latlong.hpp>
+#include <boost/geometry/extensions/gis/geographic/strategies/andoyer.hpp>
+#include <boost/geometry/strategies/spherical/distance_cross_track.hpp>
 
 #ifndef NO_PROJECTION
-#include <boost/geometry/extensions/gis/projections/proj/sterea.hpp>
-#include <boost/geometry/extensions/gis/projections/parameters.hpp>
+#  include <boost/geometry/extensions/gis/projections/proj/sterea.hpp>
+#  include <boost/geometry/extensions/gis/projections/proj/laea.hpp>
+#  include <boost/geometry/extensions/gis/projections/parameters.hpp>
 #endif
 
+// BSG 28-10-2010
+// TODO: celar up this test
+// it is more a test than an example
+// the results are sometimes WRONG
+
 int main()
 {
+
     using namespace boost::geometry;
 
     typedef model::point_ll_deg latlon_point;
 
-    latlon_point a;
+    latlon_point city1;
     // Amsterdam 52 22'23"N 4 53'32"E
-    a.lat(dms<north>(52, 22, 23));
-    a.lon(dms<east>(4, 53, 32));
+    std::string const city1_name = "Amsterdam";
+    city1.lat(dms<north>(52, 22, 23));
+    city1.lon(dms<east>(4, 53, 32));
 
     // Rotterdam 51 55'51"N 4 28'45"E
-    latlon_point r(latitude<>(dms<north>(51, 55, 51)), longitude<>(dms<east>(4, 28, 45)));
+    // latlon_point city2(latitude<>(dms<north>(51, 55, 51)), longitude<>(dms<east>(4, 28, 45)));
+    // Paris 48 52' 0" N, 2 19' 59" E
+    std::string const city2_name = "Paris";
+    latlon_point city2(latitude<>(dms<north>(48, 52, 0)), longitude<>(dms<east>(2, 19, 59)));
+
+    // The Hague: 52 4' 48" N, 4 18' 0" E
+    //latlon_point city3(longitude<>(dms<east>(4, 18, 0)), latitude<>(dms<north>(52, 4, 48)));
+    // Barcelona
+    std::string const city3_name = "Barcelona";
+    latlon_point city3(longitude<>(dms<east>(2, 11, 0)), latitude<>(dms<north>(41, 23, 0)));
 
-    // The hague: 52 4' 48" N, 4 18' 0" E
-    latlon_point h(longitude<>(dms<east>(4, 18, 0)), latitude<>(dms<north>(52, 4, 48)));
 
     model::point_ll_rad a_rad, r_rad, h_rad;
-    transform(a, a_rad);
-    transform(r, r_rad);
-    transform(h, h_rad);
+    transform(city1, a_rad);
+    transform(city2, r_rad);
+    transform(city3, h_rad);
 
 #ifndef NO_PROJECTION
+    /*
     projection::sterea_ellipsoid<model::point_ll_rad, model::point_2d> proj
         (projection::init(
         "+lat_0=52.15616055555555 +lon_0=5.38763888888889 +k=0.9999079 +x_0=155000 +y_0=463000 +ellps=bessel +units=m"));
+    */
+    projection::laea_ellipsoid<model::point_ll_rad, model::point_2d> proj
+        (projection::init(
+        " +lat_0=52 +lon_0=10 +x_0=4321000 +y_0=3210000 +ellps=GRS80 +units=m"));
+
 
     model::point_2d a_rd, r_rd, h_rd;
     proj.forward(a_rad, a_rd);
@@ -65,44 +88,43 @@
     // Distances
     // ------------------------------------------------------------------------------------------
 
-    std::cout << "Distance Amsterdam-Rotterdam: " << std::endl;
-    std::cout << "haversine:              " << 0.001 * distance(a, r) << " km" << std::endl;
+    std::cout << "Distance " << city1_name << "-" << city2_name << ": " << std::endl;
+    std::cout << "haversine:              " << 0.001 * distance(city1, city2) << " km" << std::endl;
     std::cout << "haversine rad:          " << 0.001 * distance(a_rad, r_rad) << " km" << std::endl;
-    std::cout << "haversine other radius: " << distance(a, r, strategy::distance::haversine<latlon_point>(6371.0) ) << " km" << std::endl;
-    std::cout << "andoyer:                " << 0.001 * distance(a, r, strategy::distance::andoyer<latlon_point>() ) << " km" << std::endl;
-    std::cout << "vincenty:               " << 0.001 * distance(a, r, strategy::distance::vincenty<latlon_point>() ) << " km" << std::endl;
+    std::cout << "haversine other radius: " << distance(city1, city2, strategy::distance::haversine<latlon_point>(6371.0) ) << " km" << std::endl;
+    std::cout << "andoyer:                " << 0.001 * distance(city1, city2, strategy::distance::andoyer<latlon_point>() ) << " km" << std::endl;
+    std::cout << "vincenty:               " << 0.001 * distance(city1, city2, strategy::distance::vincenty<latlon_point>() ) << " km" << std::endl;
     std::cout << "vincenty rad:           " << 0.001 * distance(a_rad, r_rad, strategy::distance::vincenty<model::point_ll_rad>() ) << " km" << std::endl;
-    std::cout << "RD, pythagoras:         " << 0.001 * distance(a_rd, r_rd) << " km" << std::endl;
+    std::cout << "Projected, pythagoras:  " << 0.001 * distance(a_rd, r_rd) << " km" << std::endl;
 
     std::cout << std::endl;
-    std::cout << "Distance Amsterdam-Den Haag: " << std::endl;
-    std::cout << "haversine:              " << 0.001 * distance(a, h) << " km" << std::endl;
+    std::cout << "Distance " << city1_name << "-" << city3_name << ": " << std::endl;
+    std::cout << "andoyer:                " << 0.001 * distance(city1, city3, strategy::distance::andoyer<latlon_point>()) << " km" << std::endl;
+    std::cout << "Distance " << city2_name << "-" << city3_name << ": " << std::endl;
+    std::cout << "andoyer:                " << 0.001 * distance(city2, city3, strategy::distance::andoyer<latlon_point>()) << " km" << std::endl;
 
     // ------------------------------------------------------------------------------------------
     // Distances to segments
     // ------------------------------------------------------------------------------------------
-    std::cout << std::endl << "The Hague - line Amsterdam,Rotterdam" << std::endl;
+    std::cout << std::endl << city3_name << " - line " << city1_name << "," << city2_name << std::endl;
 
     model::segment_2d ar_xy(a_rd, r_rd);
 
     double dr = distance(h_rd, ar_xy);
     std::cout << "in RD: " << 0.001 * dr << std::endl;
 
-    /* TO BE FIXED
-    // TODO: fix this
-    // Temporary fix: multiply with Earth Radius. This will be refactored.
-    double const er = 6378137.0;
+    double const radius = 6378137.0;
 
-    dr = er * distance(h, model::segment_ll_deg(a, r));
+    dr = distance(city3, model::segment_ll_deg(city1, city2));
     std::cout << "in LL: " << 0.001 * dr << std::endl;
 
-    std::cout << std::endl << "Rotterdam - line Amsterdam,the Hague" << std::endl;
+    std::cout << std::endl << city2_name << " - line " << city1_name << "," << city3_name << std::endl;
     dr = distance(r_rd, model::segment_2d(a_rd, h_rd));
     std::cout << "in RD: " << 0.001 * dr << std::endl;
-    dr = er * distance(r, model::segment_ll_deg(a, h));
+    dr = distance(city2, model::segment_ll_deg(city1, city3));
     std::cout << "in LL: " << 0.001 * dr << std::endl;
     std::cout << std::endl;
-    */
+    
 
     // ------------------------------------------------------------------------------------------
     // Compilation
@@ -111,20 +133,20 @@
     //std::cout << "vincenty on xy:         " << 0.001 * distance(a_rd, r_rd, formulae::distance::vincenty<>() ) << " km" << std::endl;
 
     // Next line does not compile because you cannot (yet) assign degree to radian directly
-    //point_ll_rad a_rad2 = a;
+    //point_ll_rad a_rad2 = city1;
 
     // Next line does not compile because you cannot assign latlong to xy
-    // point_2d axy = a;
+    // point_2d axy = city1;
 
     // ------------------------------------------------------------------------------------------
     // Length
     // ------------------------------------------------------------------------------------------
     // Length calculations use distances internally. The lines below take automatically the default
-    // formulae for distance. However, you can also specify a formula explicitly.
+    // formulae for distance. However, you can also specify city1 formula explicitly.
 
     model::linestring_ll_deg line1;
-    append(line1, a);
-    append(line1, r);
+    append(line1, city1);
+    append(line1, city2);
     std::cout << "length: " << length(line1) << std::endl;
     std::cout << "length using Vincenty: " << length(line1, strategy::distance::vincenty<latlon_point>()) << std::endl;
 
Deleted: sandbox/geometry/libs/geometry/example/with_external_libs/contrib/shapelib-1.3.0b2/readme.txt
==============================================================================
--- sandbox/geometry/libs/geometry/example/with_external_libs/contrib/shapelib-1.3.0b2/readme.txt	2010-11-28 16:49:46 EST (Sun, 28 Nov 2010)
+++ (empty file)
@@ -1,24 +0,0 @@
-// Boost.Geometry (aka GGL, Generic Geometry Library) test file
-//
-// Copyright Barend Gehrels 2010, Geodan, Amsterdam, the Netherlands
-// Use, modification and distribution is subject to the Boost Software License,
-// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-
-
-
-Download shapelib from 
-http://shapelib.maptools.org/
-or http://download.osgeo.org/shapelib/
-
-and extract to this folder.
-
-
-Install at least the following files:
-- shpopen.c 
-- shapefil.h 
-- dbfopen.c 
-
-For new shapelibs:
-- safileio.c 
-
Deleted: sandbox/geometry/libs/geometry/example/with_external_libs/x02_numeric_adaptor_example.cpp
==============================================================================
--- sandbox/geometry/libs/geometry/example/with_external_libs/x02_numeric_adaptor_example.cpp	2010-11-28 16:49:46 EST (Sun, 28 Nov 2010)
+++ (empty file)
@@ -1,139 +0,0 @@
-// Boost.Geometry (aka GGL, Generic Geometry Library)
-//
-// Copyright Barend Gehrels 2007-2009, Geodan, Amsterdam, the Netherlands
-// Copyright Bruno Lalande 2008, 2009
-// Use, modification and distribution is subject to the Boost Software License,
-// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-
-// Numeric Adaptor Example
-
-// The Numeric Adaptor is introduced to the Boost mailing list
-// It is a proxy to high precision arithmetic libraries such as gmp
-// However, it might be that the same effect can be used using the
-// Boost.Math bindings.
-
-// To build and run this example:
-// 1) download gmp, it should be somewhere in the include path
-// 2) download numeric_adaptor from the Boost.Sandbox
-
-#include <iostream>
-#include <iomanip>
-#include <typeinfo>
-
-#include <boost/numeric_adaptor/numeric_adaptor.hpp>
-#include <boost/numeric_adaptor/gmp_value_type.hpp>
-
-#include <boost/geometry/geometry.hpp>
-#include <boost/geometry/geometries/cartesian2d.hpp>
-
-template <typename Type, typename AssignType>
-void calculate(AssignType const& x1,
-               AssignType const& y1,
-               AssignType const& x2,
-               AssignType const& y2,
-               AssignType const& x3,
-               AssignType const& y3
-               )
-{
-    // gmp can be used instead of "double" for any point type
-    typedef boost::geometry::point_xy<Type> point_type;
-
-    point_type a, b, c;
-    boost::geometry::assign(a, boost::to<Type>(x1), boost::to<Type>(y1));
-    boost::geometry::assign(b, boost::to<Type>(x2), boost::to<Type>(y2));
-    boost::geometry::assign(c, boost::to<Type>(x3), boost::to<Type>(y3));
-
-    boost::geometry::linear_ring<point_type> r;
-    r.push_back(a);
-    r.push_back(b);
-    r.push_back(c);
-    r.push_back(a);
-
-    // What also is possible is define point coordinates using IEEE double,
-    // but doing calculations using the gmp type.
-    // To do that, specify the strategy explicitly
-    Type ab = boost::geometry::distance(a, b);
-    Type bc = boost::geometry::distance(b, c);
-    Type ca = boost::geometry::distance(c, a);
-
-    std::cout << std::endl << typeid(Type).name() << std::endl;
-
-    std::cout << "a-b: " << ab << std::endl;
-    std::cout << "b-c: " << bc << std::endl;
-    std::cout << "c-a: " << ca << std::endl;
-
-    std::cout << "area:  " << boost::geometry::area(r,
-            boost::geometry::strategy::area::by_triangles<point_type, Type>())
-        << std::endl;
-
-    // Heron formula is "famous" for its imprecision. It should give
-    // same result as area, but is sensible for rounding errors.
-    Type s = ab + bc + ca;
-    s /= 2.0;
-    Type ar = boost::sqrt(s * (s - ab) * (s - bc) * (s - ca));
-    std::cout << "heron: " << ar << std::endl;
-
-    // Area's given:
-    // float:       740.74078369140625
-    // double:      740.74073407406990554591
-    // long double: 740.74073407406991376156
-    // GMP:        0.74074073407407e3 (right!)
-
-    // SQL Server:  740.740724252642
-    // Postgis:     740.74073407407 (might be rounded from (long) double)
-    // MySQL:       740.74073407406991000000
-}
-
-int main(int argc, char *argv[])
-{
-    typedef boost::numeric_adaptor::gmp_value_type type;
-    //typedef long double type;
-
-    // gmp can be used instead of "double" for any point type
-    typedef boost::geometry::point_xy<type> point_type;
-
-    // Points, polygons or other geometries are gmp now
-    point_type p;
-
-    // They can be used normally
-    boost::geometry::set<0>(p, 123456.78900001);
-    std::cout << "x coordinate: " << boost::geometry::get<0>(p) << std::endl;
-
-    // But the value above cannot be expressed with that precision in IEEE 64 bits.
-    // Points can therefore also be assigned by string with boost::geometry::set
-    // (boost::to is a converser included in the Numeric Adaptor sources)
-    boost::geometry::set<0>(p, boost::to<type>(std::string("123456.78900001")));
-
-    // and streamed (as a string representation)
-    std::cout << "x coordinate: " << boost::geometry::get<0>(p) << std::endl;
-
-
-    // The boost::geometry::assign function also supports custom numeric types
-    point_type p1, p2;
-    boost::geometry::assign(p1,
-        boost::to<type>(std::string("123456.78900001")),
-        boost::to<type>(std::string("234567.89100001")));
-    boost::geometry::assign(p2,
-        boost::to<type>(std::string("987654.32100001")),
-        boost::to<type>(std::string("876543.21900001")));
-
-    type d = boost::geometry::distance(p1, p2);
-    std::cout << "Exact distance: " << d << std::endl;
-    // It gives:          0.1076554 54858339556783e7
-    // my calculator gives: 1076554.5485833955678294387789057
-    // CLN gives          : 1076554.5485833955
-
-    // All algorithms will automatically use the gmp-type
-    // We show and compare that in the calculate function, with type and
-    // assigning type as template parameters
-
-    std::cout << std::fixed << std::setprecision(20);
-    calculate<float>(0.0, 0.0, 0.0, 0.0012, 1234567.89012345, 0.0);
-    calculate<double>(0.0, 0.0, 0.0, 0.0012, 1234567.89012345, 0.0);
-    calculate<long double>(0.0, 0.0, 0.0, 0.0012, 1234567.89012345, 0.0);
-    calculate<type, std::string>("0.0", "0.0", "0.0", "0.0012", "1234567.89012345", "0.0");
-
-    return 0;
-}
-
Deleted: sandbox/geometry/libs/geometry/example/with_external_libs/x02_numeric_adaptor_example.sln
==============================================================================
--- sandbox/geometry/libs/geometry/example/with_external_libs/x02_numeric_adaptor_example.sln	2010-11-28 16:49:46 EST (Sun, 28 Nov 2010)
+++ (empty file)
@@ -1,19 +0,0 @@
-Microsoft Visual Studio Solution File, Format Version 9.00
-# Visual C++ Express 2005
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "x02_numeric_adaptor_example", "x02_numeric_adaptor_example.vcproj", "{242C6ADC-3A10-4B69-81F7-5669E0582A8B}"
-EndProject
-Global
-	GlobalSection(SolutionConfigurationPlatforms) = preSolution
-		Debug|Win32 = Debug|Win32
-		Release|Win32 = Release|Win32
-	EndGlobalSection
-	GlobalSection(ProjectConfigurationPlatforms) = postSolution
-		{242C6ADC-3A10-4B69-81F7-5669E0582A8B}.Debug|Win32.ActiveCfg = Debug|Win32
-		{242C6ADC-3A10-4B69-81F7-5669E0582A8B}.Debug|Win32.Build.0 = Debug|Win32
-		{242C6ADC-3A10-4B69-81F7-5669E0582A8B}.Release|Win32.ActiveCfg = Release|Win32
-		{242C6ADC-3A10-4B69-81F7-5669E0582A8B}.Release|Win32.Build.0 = Release|Win32
-	EndGlobalSection
-	GlobalSection(SolutionProperties) = preSolution
-		HideSolutionNode = FALSE
-	EndGlobalSection
-EndGlobal
Deleted: sandbox/geometry/libs/geometry/example/with_external_libs/x02_numeric_adaptor_example.vcproj
==============================================================================
--- sandbox/geometry/libs/geometry/example/with_external_libs/x02_numeric_adaptor_example.vcproj	2010-11-28 16:49:46 EST (Sun, 28 Nov 2010)
+++ (empty file)
@@ -1,187 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
-	ProjectType="Visual C++"
-	Version="8.00"
-	Name="x02_numeric_adaptor_example"
-	ProjectGUID="{242C6ADC-3A10-4B69-81F7-5669E0582A8B}"
-	RootNamespace="x02_numeric_adaptor_example"
-	Keyword="Win32Proj"
-	>
-	<Platforms>
-		<Platform
-			Name="Win32"
-		/>
-	</Platforms>
-	<ToolFiles>
-	</ToolFiles>
-	<Configurations>
-		<Configuration
-			Name="Debug|Win32"
-			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
-			IntermediateDirectory="$(ConfigurationName)\x02_numeric_adaptor_example"
-			ConfigurationType="1"
-			InheritedPropertySheets="..\boost.vsprops"
-			CharacterSet="1"
-			>
-			<Tool
-				Name="VCPreBuildEventTool"
-			/>
-			<Tool
-				Name="VCCustomBuildTool"
-			/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"
-			/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"
-			/>
-			<Tool
-				Name="VCMIDLTool"
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="0"
-				AdditionalIncludeDirectories=""c:\gmp\gmp-dynamic";c:\svn\numeric_adaptor"
-				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
-				
-				BasicRuntimeChecks="3"
-				
-				UsePrecompiledHeader="0"
-				WarningLevel="3"
-				Detect64BitPortabilityProblems="true"
-				DebugInformationFormat="1"
-			/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCPreLinkEventTool"
-			/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalDependencies="gmp.lib"
-				\
-				AdditionalLibraryDirectories=""C:\gmp\gmp-dynamic""
-				GenerateDebugInformation="true"
-				SubSystem="1"
-				TargetMachine="1"
-			/>
-			<Tool
-				Name="VCALinkTool"
-			/>
-			<Tool
-				Name="VCManifestTool"
-			/>
-			<Tool
-				Name="VCXDCMakeTool"
-			/>
-			<Tool
-				Name="VCBscMakeTool"
-			/>
-			<Tool
-				Name="VCFxCopTool"
-			/>
-			<Tool
-				Name="VCAppVerifierTool"
-			/>
-			<Tool
-				Name="VCWebDeploymentTool"
-			/>
-			<Tool
-				Name="VCPostBuildEventTool"
-			/>
-		</Configuration>
-		<Configuration
-			Name="Release|Win32"
-			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
-			IntermediateDirectory="$(ConfigurationName)\x02_numeric_adaptor_example"
-			ConfigurationType="1"
-			InheritedPropertySheets="..\boost.vsprops"
-			CharacterSet="1"
-			WholeProgramOptimization="1"
-			>
-			<Tool
-				Name="VCPreBuildEventTool"
-			/>
-			<Tool
-				Name="VCCustomBuildTool"
-			/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"
-			/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"
-			/>
-			<Tool
-				Name="VCMIDLTool"
-			/>
-			<Tool
-				Name="VCCLCompilerTool"
-				AdditionalIncludeDirectories=""c:\gmp\gmp-dynamic";c:\svn\numeric_adaptor"
-				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
-				
-				UsePrecompiledHeader="0"
-				WarningLevel="3"
-				Detect64BitPortabilityProblems="true"
-				
-			/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCResourceCompilerTool"
-			/>
-			<Tool
-				Name="VCPreLinkEventTool"
-			/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalDependencies="gmp.lib"
-				\
-				AdditionalLibraryDirectories=""C:\gmp\gmp-dynamic""
-				GenerateDebugInformation="true"
-				SubSystem="1"
-				OptimizeReferences="2"
-				EnableCOMDATFolding="2"
-				TargetMachine="1"
-			/>
-			<Tool
-				Name="VCALinkTool"
-			/>
-			<Tool
-				Name="VCManifestTool"
-			/>
-			<Tool
-				Name="VCXDCMakeTool"
-			/>
-			<Tool
-				Name="VCBscMakeTool"
-			/>
-			<Tool
-				Name="VCFxCopTool"
-			/>
-			<Tool
-				Name="VCAppVerifierTool"
-			/>
-			<Tool
-				Name="VCWebDeploymentTool"
-			/>
-			<Tool
-				Name="VCPostBuildEventTool"
-			/>
-		</Configuration>
-	</Configurations>
-	<References>
-	</References>
-	<Files>
-		<File
-			RelativePath=".\x02_numeric_adaptor_example.cpp"
-			>
-		</File>
-	</Files>
-	<Globals>
-	</Globals>
-</VisualStudioProject>
Modified: sandbox/geometry/libs/geometry/test/extensions/gis/latlong/Jamfile.v2
==============================================================================
--- sandbox/geometry/libs/geometry/test/extensions/gis/latlong/Jamfile.v2	(original)
+++ sandbox/geometry/libs/geometry/test/extensions/gis/latlong/Jamfile.v2	2010-11-28 16:49:46 EST (Sun, 28 Nov 2010)
@@ -10,6 +10,7 @@
     :
     [ run andoyer.cpp ]
     [ run area_ll.cpp ]
+    [ run cross_track.cpp ]
     [ run distance_mixed.cpp ]
     [ run point_ll.cpp ]
     [ run vincenty.cpp ]
Modified: sandbox/geometry/libs/geometry/test/extensions/gis/latlong/andoyer.cpp
==============================================================================
--- sandbox/geometry/libs/geometry/test/extensions/gis/latlong/andoyer.cpp	(original)
+++ sandbox/geometry/libs/geometry/test/extensions/gis/latlong/andoyer.cpp	2010-11-28 16:49:46 EST (Sun, 28 Nov 2010)
@@ -49,6 +49,15 @@
     test_andoyer<P1, P2>(0, 90, 1, 80, 1116.814237); // polar
     test_andoyer<P1, P2>(4, 52, 4, 52, 0.0); // no point difference
     test_andoyer<P1, P2>(4, 52, 3, 40, 1336.039890); // normal case
+
+    /* SQL Server gives:
+        1116.82586908528, 0, 1336.02721932545
+
+       with:
+SELECT 0.001 * geography::STGeomFromText('POINT(0 90)', 4326).STDistance(geography::STGeomFromText('POINT(1 80)', 4326))	
+union SELECT 0.001 * geography::STGeomFromText('POINT(4 52)', 4326).STDistance(geography::STGeomFromText('POINT(4 52)', 4326))	
+union SELECT 0.001 * geography::STGeomFromText('POINT(4 52)', 4326).STDistance(geography::STGeomFromText('POINT(3 40)', 4326))	
+     */
 }
 
 template <typename P>
Added: sandbox/geometry/libs/geometry/test/extensions/gis/latlong/cross_track.cpp
==============================================================================
--- (empty file)
+++ sandbox/geometry/libs/geometry/test/extensions/gis/latlong/cross_track.cpp	2010-11-28 16:49:46 EST (Sun, 28 Nov 2010)
@@ -0,0 +1,129 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library) test file
+//
+// Copyright Barend Gehrels 2007-2009, Geodan, Amsterdam, the Netherlands
+// Copyright Bruno Lalande 2008, 2009
+// Use, modification and distribution is subject to the Boost Software License,
+// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+
+#include <geometry_test_common.hpp>
+
+
+#include <boost/geometry/algorithms/assign.hpp>
+#include <boost/geometry/algorithms/distance.hpp>
+
+#include <boost/geometry/strategies/spherical/distance_haversine.hpp>
+#include <boost/geometry/strategies/spherical/distance_cross_track.hpp>
+#include <boost/geometry/extensions/gis/geographic/strategies/andoyer.hpp>
+#include <boost/geometry/extensions/gis/geographic/strategies/distance_cross_track.hpp>
+
+#include <boost/geometry/strategies/concepts/distance_concept.hpp>
+
+#include <boost/geometry/geometries/point.hpp>
+#include <boost/geometry/geometries/segment.hpp>
+
+
+
+
+template <typename Point>
+void test_distance(
+            typename bg::coordinate_type<Point>::type const& lon1, 
+            typename bg::coordinate_type<Point>::type const& lat1,
+            typename bg::coordinate_type<Point>::type const& lon2, 
+            typename bg::coordinate_type<Point>::type const& lat2,
+            typename bg::coordinate_type<Point>::type const& lon3, 
+            typename bg::coordinate_type<Point>::type const& lat3,
+            typename bg::coordinate_type<Point>::type const& radius, 
+            typename bg::coordinate_type<Point>::type const&expected, 
+            typename bg::coordinate_type<Point>::type const&tolerance)
+{
+    typedef bg::strategy::distance::cross_track
+        <
+            Point,
+            Point
+        > strategy_type;
+    typedef typename bg::strategy::distance::services::return_type
+        <
+            strategy_type
+        >::type return_type;
+
+
+    BOOST_CONCEPT_ASSERT
+        (
+            (bg::concept::PointSegmentDistanceStrategy<strategy_type>)
+        );
+
+    //typedef bg::strategy::distance::andoyer<Point, Point> andoyer_type;
+
+
+
+    Point p1, p2, p3;
+    bg::assign(p1, lon1, lat1);
+    bg::assign(p2, lon2, lat2);
+    bg::assign(p3, lon3, lat3);
+
+    strategy_type strategy;
+    return_type d = strategy.apply(p1, p2, p3);
+    BOOST_CHECK_CLOSE(d, expected, tolerance);
+
+    // Test the "default strategy" registration
+    bg::model::referring_segment<Point const> segment(p2, p3);
+    d = bg::distance(p1, segment);
+    BOOST_CHECK_CLOSE(d, expected, tolerance);
+}
+
+template <typename Point>
+void test_all()
+{
+    double const average_earth_radius = 6372795.0;
+
+    // distance (Paris <-> Amsterdam/Barcelona), 
+    // with coordinates rounded as below ~87 km
+    // should be is equal
+    // to distance (Paris <-> Barcelona/Amsterdam)
+    double p_to_ab = 86.8238 * 1000.0;
+    test_distance<Point>(2, 48, 4, 52, 2, 41, average_earth_radius, p_to_ab, 0.1);
+
+    // Note that for andoyer/geographic it is currently not symmetrical
+    p_to_ab = 86.7186 * 1000.0;
+    test_distance<Point>(2, 48, 2, 41, 4, 52, average_earth_radius, p_to_ab, 0.1);
+
+    /*
+        SQL Server queries:
+            SELECT 'Am*dam-Barcelona - Paris' as dist, 0.001 * geography::STGeomFromText('LINESTRING(4.9 52.36667, 2.183333 41.383333)', 4326)
+            .STDistance(geography::STGeomFromText('POINT(2.350833 48.856667)', 4326))
+            union	
+            SELECT 'London-Vienna - Paris' as dist, 0.001 * geography::STGeomFromText('LINESTRING(-0.1275 51.507222, 16.373056 48.208333)', 4326)
+            .STDistance(geography::STGeomFromText('POINT(2.350833 48.856667)', 4326))
+        -> 112.377543374738 252.655192414418
+    
+        PostGis Queries:
+            SELECT 'Am*dam-Barcelona - Paris' as dist, 0.001 * ST_Distance(ST_GeographyFromText('LINESTRING(4.9 52.36667, 2.183333 41.383333)')
+            , ST_GeographyFromText('POINT(2.350833 48.856667)'))
+            union	
+            SELECT 'London-Vienna - Paris' as dist, 0.001 * ST_Distance(ST_GeographyFromText('LINESTRING(-0.1275 51.507222, 16.373056 48.208333)')
+            , ST_GeographyFromText('POINT(2.350833 48.856667)'))
+
+        -> 112.377594693992, 252.655380438615
+
+    */
+
+    // There are small deviations from the result.
+    // TODO: fix this, probably another strategy is necessary for ellipsoidal.
+    test_distance<Point>(2.350833, 48.856667, 4.9, 52.36667, 2.183333, 41.383333, average_earth_radius, 112.377 * 1000.0, 0.25);
+    test_distance<Point>(2.350833, 48.856667, -0.1275, 51.507222, 16.373056, 48.208333, average_earth_radius, 252.655 * 1000.0, 0.25);
+}
+
+
+int test_main(int, char* [])
+{
+    test_all<bg::model::point<double, 2, bg::cs::geographic<bg::degree> > >();
+
+#if defined(HAVE_TTMATH)
+    typedef ttmath::Big<1,4> tt;
+    test_all<bg::model::point<tt, 2, bg::cs::geographic<bg::degree> > >();
+#endif
+
+    return 0;
+}
Added: sandbox/geometry/libs/geometry/test/extensions/gis/latlong/cross_track.vcproj
==============================================================================
--- (empty file)
+++ sandbox/geometry/libs/geometry/test/extensions/gis/latlong/cross_track.vcproj	2010-11-28 16:49:46 EST (Sun, 28 Nov 2010)
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="cross_track"
+	ProjectGUID="{572678FB-A286-4F68-B2D5-F9C9EAC392FE}"
+	RootNamespace="cross_track"
+	Keyword="Win32Proj"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)\cross_track"
+			ConfigurationType="1"
+			InheritedPropertySheets="..\..\..\boost.vsprops;..\..\..\ttmath.vsprops"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="../../../../../..;../../.."
+				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+				ExceptionHandling="2"
+				RuntimeLibrary="1"
+				UsePrecompiledHeader="0"
+				DebugInformationFormat="1"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				GenerateDebugInformation="true"
+				SubSystem="1"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)\cross_track"
+			ConfigurationType="1"
+			InheritedPropertySheets="..\..\..\boost.vsprops;..\..\..\ttmath.vsprops"
+			CharacterSet="1"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="../../../../../..;../../.."
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+				ExceptionHandling="2"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				SubSystem="1"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<File
+			RelativePath=".\cross_track.cpp"
+			>
+		</File>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>
Modified: sandbox/geometry/libs/geometry/test/extensions/gis/latlong/latlong.sln
==============================================================================
--- sandbox/geometry/libs/geometry/test/extensions/gis/latlong/latlong.sln	(original)
+++ sandbox/geometry/libs/geometry/test/extensions/gis/latlong/latlong.sln	2010-11-28 16:49:46 EST (Sun, 28 Nov 2010)
@@ -15,6 +15,8 @@
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vincenty", "vincenty.vcproj", "{F4A5BE68-7213-498D-944B-023B50FB10FD}"
 EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cross_track", "cross_track.vcproj", "{572678FB-A286-4F68-B2D5-F9C9EAC392FE}"
+EndProject
 Global
         GlobalSection(SolutionConfigurationPlatforms) = preSolution
                 Debug|Win32 = Debug|Win32
@@ -49,6 +51,10 @@
                 {F4A5BE68-7213-498D-944B-023B50FB10FD}.Debug|Win32.Build.0 = Debug|Win32
                 {F4A5BE68-7213-498D-944B-023B50FB10FD}.Release|Win32.ActiveCfg = Release|Win32
                 {F4A5BE68-7213-498D-944B-023B50FB10FD}.Release|Win32.Build.0 = Release|Win32
+		{572678FB-A286-4F68-B2D5-F9C9EAC392FE}.Debug|Win32.ActiveCfg = Debug|Win32
+		{572678FB-A286-4F68-B2D5-F9C9EAC392FE}.Debug|Win32.Build.0 = Debug|Win32
+		{572678FB-A286-4F68-B2D5-F9C9EAC392FE}.Release|Win32.ActiveCfg = Release|Win32
+		{572678FB-A286-4F68-B2D5-F9C9EAC392FE}.Release|Win32.Build.0 = Release|Win32
         EndGlobalSection
         GlobalSection(SolutionProperties) = preSolution
                 HideSolutionNode = FALSE
Modified: sandbox/geometry/libs/geometry/test/extensions/gis/projections/projections.cpp
==============================================================================
--- sandbox/geometry/libs/geometry/test/extensions/gis/projections/projections.cpp	(original)
+++ sandbox/geometry/libs/geometry/test/extensions/gis/projections/projections.cpp	2010-11-28 16:49:46 EST (Sun, 28 Nov 2010)
@@ -33,7 +33,10 @@
 
 inline void check(double v, double ve, std::string const& name, std::string const& axis)
 {
-    if (! boost::test_tools::check_is_close(v, ve, 0.001))
+    //BOOST_CHECK_CLOSE(v, ve, 0.001);
+    // Instead of (non-existing) BOOST_CHECK_CLOSE_MESSAGE(v, ve, 0.001, bla bla)
+
+    if (! boost::test_tools::check_is_close(v, ve, boost::test_tools::percent_tolerance(0.001)))
     {
         std::ostringstream out;
         out << "\n" << name << " " << axis << " -> " << v << " != " << ve;
Modified: sandbox/geometry/libs/geometry/test/strategies/cross_track.cpp
==============================================================================
--- sandbox/geometry/libs/geometry/test/strategies/cross_track.cpp	(original)
+++ sandbox/geometry/libs/geometry/test/strategies/cross_track.cpp	2010-11-28 16:49:46 EST (Sun, 28 Nov 2010)
@@ -11,6 +11,7 @@
 
 
 #include <boost/geometry/algorithms/assign.hpp>
+#include <boost/geometry/algorithms/distance.hpp>
 
 #include <boost/geometry/strategies/spherical/distance_haversine.hpp>
 #include <boost/geometry/strategies/spherical/distance_cross_track.hpp>
@@ -20,24 +21,30 @@
 #include <boost/geometry/geometries/point.hpp>
 #include <boost/geometry/geometries/segment.hpp>
 
-#ifdef HAVE_TTMATH
-#  include <boost/geometry/extensions/contrib/ttmath_stub.hpp>
-#endif
+
 
 
 template <typename Point>
-void test_distance(double lon1, double lat1,
-                   double lon2, double lat2,
-                   double lon3, double lat3,
-                   double radius, double expected, double tolerance)
+void test_distance(
+            typename bg::coordinate_type<Point>::type const& lon1, 
+            typename bg::coordinate_type<Point>::type const& lat1,
+            typename bg::coordinate_type<Point>::type const& lon2, 
+            typename bg::coordinate_type<Point>::type const& lat2,
+            typename bg::coordinate_type<Point>::type const& lon3, 
+            typename bg::coordinate_type<Point>::type const& lat3,
+            typename bg::coordinate_type<Point>::type const& radius, 
+            typename bg::coordinate_type<Point>::type const& expected, 
+            typename bg::coordinate_type<Point>::type const& tolerance)
 {
     typedef bg::strategy::distance::cross_track
         <
             Point,
             Point
         > strategy_type;
-    typedef typename strategy_type::return_type return_type;
-
+    typedef typename bg::strategy::distance::services::return_type
+        <
+            strategy_type
+        >::type return_type;
 
 
     BOOST_CONCEPT_ASSERT
@@ -46,28 +53,43 @@
         );
 
 
-    strategy_type strategy(radius);
-
     Point p1, p2, p3;
     bg::assign(p1, lon1, lat1);
     bg::assign(p2, lon2, lat2);
     bg::assign(p3, lon3, lat3);
+
+
+    strategy_type strategy;
     return_type d = strategy.apply(p1, p2, p3);
 
-    BOOST_CHECK_CLOSE(d, return_type(expected), tolerance);
+    BOOST_CHECK_CLOSE(radius * d, expected, tolerance);
+
+    // Test specifying radius explicitly
+    strategy_type strategy_radius(radius);
+    d = strategy_radius.apply(p1, p2, p3);
+    BOOST_CHECK_CLOSE(d, expected, tolerance);
+
+
+    // Test the "default strategy" registration
+    bg::model::referring_segment<Point const> segment(p2, p3);
+    d = bg::distance(p1, segment);
+    BOOST_CHECK_CLOSE(radius * d, expected, tolerance);
 }
 
+
+
 template <typename Point>
 void test_all()
 {
-    double const average_earth_radius = 6372795.0;
+    typename bg::coordinate_type<Point>::type const average_earth_radius = 6372795.0;
 
-    // distance (Paris <-> Amsterdam/Barcelona), ~87 km
+    // distance (Paris <-> Amsterdam/Barcelona), 
+    // with coordinates rounded as below ~87 km
     // should be is equal
     // to distance (Paris <-> Barcelona/Amsterdam)
-    double const p_to_ab = 86.8 * 1000.0;
-    test_distance<Point>(2, 48, 4, 52, 2, 41, average_earth_radius, p_to_ab, 1.0);
-    test_distance<Point>(2, 48, 2, 41, 4, 52, average_earth_radius, p_to_ab, 1.0);
+    typename bg::coordinate_type<Point>::type const p_to_ab = 86.798321 * 1000.0;
+    test_distance<Point>(2, 48, 4, 52, 2, 41, average_earth_radius, p_to_ab, 0.1);
+    test_distance<Point>(2, 48, 2, 41, 4, 52, average_earth_radius, p_to_ab, 0.1);
 }
 
 
@@ -77,10 +99,8 @@
 
 #if defined(HAVE_TTMATH)
     typedef ttmath::Big<1,4> tt;
-    test_all<bg::model::point<tt, 2, bg::cs::spherical<bg::degree> > >();
+    //test_all<bg::model::point<tt, 2, bg::cs::spherical<bg::degree> > >();
 #endif
 
-
-
     return 0;
 }