1 // Boost.Geometry (aka GGL, Generic Geometry Library)
4 // Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands.
6 // Use, modification and distribution is subject to the Boost Software License,
7 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
8 // http://www.boost.org/LICENSE_1_0.txt)
11 //` The following simple example shows the calculation of the length of a linestring containing three points
14 #include <boost/geometry.hpp>
15 #include <boost/geometry/geometries/linestring.hpp>
16 #include <boost/geometry/geometries/point_xy.hpp>
21 using namespace boost::geometry;
22 model::linestring<model::d2::point_xy<double> > line;
23 read_wkt("linestring(0 0,1 1,4 8,3 2)", line);
24 std::cout << "linestring length is "
26 << " units" << std::endl;
38 linestring length is 15.1127 units