Opened 4 years ago

Closed 4 years ago

#10345 closed Bugs (fixed)

Distance fails to compile for some coordinate types

Reported by: Branimir Betov <bbetov@…> Owned by: mkaravel
Milestone: Boost 1.57.0 Component: geometry
Version: Boost 1.56.0 Severity: Problem
Keywords: Cc: mkaravel


Using Boost 1.56 and Visual C++ (2010, 2012, and 2013) the following code fails to compile and it used to work in 1.55.

#include "stdafx.h"
#include <string>
#include <fstream>
#include <streambuf>
#include <boost/geometry.hpp>
#include "boost/geometry/geometry.hpp"
#include <boost/geometry/algorithms/distance.hpp>
#include <boost/geometry/io/io.hpp>
namespace bg = boost::geometry;
using namespace std;

int _tmain(int argc, _TCHAR* argv[])
        typedef bg::model::point<double, 2, bg::cs::spherical_equatorial<double>> mypt;
        typedef bg::model::polygon<mypt> mypoly;
        mypoly poly;
        mypt pto(-122.13865, 38.69311);

        std::string str = "POLYGON((-122.07493 37.62602,-122.07585 37.626158,-122.07638 37.6258760,-122.076338 37.6253233,-122.075417 37.625003,-122.074693 37.62521,-122.0744 37.625605,-122.07449 37.625765,-122.07449 37.6257,-122.07493 37.62602))";
        bg::read_wkt(str, poly);
        double aa = bg::distance(pto, poly); // in m

        return 0;

The same failure happens for spherical and geographic coordinate systems, but works fine for cartesian coordinates.

Change History (2)

comment:1 Changed 4 years ago by mkaravel

Cc: mkaravel added
Owner: changed from Barend Gehrels to mkaravel

comment:2 Changed 4 years ago by mkaravel

Milestone: To Be DeterminedBoost 1.57.0
Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.