I did some more experimentation and seems like distance between point and a polygon only works for Cartesian coordinates. I tried spherical, sperical_equatorial, and geographic - none work, but Cartesian compiles fine and returns a distance.I guess some specialization is missing, but I am not sure how to solve it.
On Sat, Aug 9, 2014 at 9:07 AM, Branimir Betov <bbetov@gmail.com> wrote:
Here is the full example I came up with. I am using visual studio (tried 2010, 2012, and 2013). For completeness I am attaching a file with the polygon definition (test.txt).
#include "stdafx.h"
#include <string>
#include <fstream>
#include <streambuf>
#include <boost/geometry.hpp>
#include "boost/geometry/geometry.hpp"
#include <boost/geometry/extensions/gis/latlong/point_ll.hpp>
#include <boost/geometry/io/io.hpp>
namespace bg = boost::geometry;
using namespace std;int _tmain(int argc, _TCHAR* argv[])
typedef bg::model::ll::point<> point;
typedef bg::model::polygon<point> polygon;
{
polygon poly;
std::string str;
std::ifstream t("c:\\temp\\test.txt");
t.seekg(0, std::ios::end);
str.reserve(t.tellg());
t.seekg(0, std::ios::beg);
str.assign((std::istreambuf_iterator<char>(t)),
std::istreambuf_iterator<char>());bg::distance(poly, p_out); // This fails to compile for some reason.
bg::read_wkt(str, poly);
const bg::latitude<double> lat_out(37.69311);
const bg::longitude<double> lon_out(-122.13865);
point p_out(lat_out, lon_out);
return 0;
}
On Sat, Aug 9, 2014 at 12:12 AM, Menelaos Karavelas <menelaos.karavelas@gmail.com> wrote:
Hi Branimir.Would it be possible to provide a minimal complete example that fails?
On 09/08/2014 05:26 πμ, Branimir Betov wrote:
Does anyone have any suggestions?Here is the relevant snippet:Hi,I am trying to figure out what is wrong with my code and am stuck, so I thought someone might help. The code used to work in 1.55 and in 1.56 no longer compiles; I am at a loss what might be wrong. I am using the GIS extension from the develop-1.56 branch.
typedef bg::model::ll::point<> point;
typedef bg::model::polygon<point> polygon;
polygon poly;
bg::read_wkt(str, poly);
const bg::latitude<double> lat_out(37.69311);
const bg::longitude<double> lon_out(-122.13865);
point p_out(lat_out, lon_out);
bg::distance(p_out, poly); // It fails to compile right here.
Thanks a lot.
- m.
Thank you,Branimir
_______________________________________________ Geometry mailing list Geometry@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/geometry
_______________________________________________
Geometry mailing list
Geometry@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/geometry
_______________________________________________ Geometry mailing list Geometry@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/geometry