boost-geometry

MySQL 5.7: Invalid GIS data

独自空忆成欢 提交于 2019-12-23 12:43:52
问题 The following query seems to be working just fine under MySQL 5.6 (returns 0 for the Area), but on MySQL 5.7 it returns an error saying ERROR 3037 (22023): Invalid GIS data provided to function st_area. . SELECT ST_Area(GeomFromText('POLYGON((0 0, 0 0, 0 0, 0 0, 0 0))')) Is it possible to either ignore the error and return zero, or create a query to filter any such geometries from the query before running it? A very simple schema and query example would be: CREATE TABLE `polygons` (`id` int,

polygons union using boost

霸气de小男生 提交于 2019-12-22 21:15:51
问题 I'm using boost::geometry::union_ to merge a vector of random polygons, and here what I wrote: #include <iostream> #include <vector> #include <fstream> #include <boost/geometry.hpp> #include <boost/geometry/geometries/point_xy.hpp> #include <boost/geometry/geometries/polygon.hpp> #include <boost/geometry/io/wkt/wkt.hpp> #include <boost/foreach.hpp> typedef boost::geometry::model::polygon<boost::geometry::model::d2::point_xy<double> > polygon; void union_polys(std::vector<polygon> In_polys,std

polygons union using boost

▼魔方 西西 提交于 2019-12-22 21:15:23
问题 I'm using boost::geometry::union_ to merge a vector of random polygons, and here what I wrote: #include <iostream> #include <vector> #include <fstream> #include <boost/geometry.hpp> #include <boost/geometry/geometries/point_xy.hpp> #include <boost/geometry/geometries/polygon.hpp> #include <boost/geometry/io/wkt/wkt.hpp> #include <boost/foreach.hpp> typedef boost::geometry::model::polygon<boost::geometry::model::d2::point_xy<double> > polygon; void union_polys(std::vector<polygon> In_polys,std

Issue with removing points from a boost::geometry::index::rtree

*爱你&永不变心* 提交于 2019-12-22 11:28:09
问题 I'm using boost 1.56 on OS X, installed through homebrew. I'm running into a compilation problem - specifically, it appears that I cannot remove values from a boost::geometry::index::rtree. Here's the code I've come up with so far: #include <iostream> #include <vector> #include <string> #include <boost/geometry.hpp> #include <boost/geometry/geometries/point.hpp> #include <boost/geometry/geometries/box.hpp> #include <boost/geometry/index/rtree.hpp> namespace bg = boost::geometry; namespace bgm

Lines intersection using Boost Geometry

拜拜、爱过 提交于 2019-12-22 10:23:34
问题 How line can be represented using Boost Geometry? I don't need finite segment, but I need infinite lines (maybe Segment or Linestring can be extended?) As I understand I can use boost::geometry::intersects , but I don't know how to define infinite line. 回答1: If you want to test whether an infinite line A intersects a line segment B , this can be done using boost::geometry::strategy::side::side_by_triangle: template <typename Point> struct line { boost::geometry::model::segment<Point> segment;

How to inherit from boost::geometry::model::point?

无人久伴 提交于 2019-12-22 09:05:56
问题 I'd like to inherit from bg::model::point to extend it with own functionality. The *point*s shall be stored in an rtree. The following minimal example fails to compile the usage of my derived point (boost 1.54, gcc 4.7.2): #include <boost/geometry.hpp> #include <boost/geometry/geometries/point.hpp> #include <boost/geometry/geometries/box.hpp> #include <boost/geometry/index/rtree.hpp> #include <iostream> #include <boost/shared_ptr.hpp> namespace bg = boost::geometry; namespace bgi = boost:

Getting the coordinates of points from a Boost Geometry polygon

谁说胖子不能爱 提交于 2019-12-22 03:55:18
问题 I have a simple DLL doing some calculations with Boost Geometry polygons. (Mostly intersections and differences.) Since the DLL will be most likely called from C# code, and from Delphi and who knows from where else, I should convert the result into arrays that everything can handle. UPDATE: I had simplified and somewhat corrected my code. The new code looks completely different, uses a completely different approach ( for_each_point ), and somehow still doesn't compile. My new code: #include

perpendicular geo distance from a point to a line using boost geometry

做~自己de王妃 提交于 2019-12-20 03:01:16
问题 I want to get perpendicular distance from a point (t) to a line segment (p, q) . The perpendicular may not intersect the line [p, q] . In that case I want to extend the line (p, q) hypothetically and then draw the perpendicular to get the distance. p, q, t are all gps coordinates. I am using boost geometry. typedef boost::geometry::model::point< double, 2, boost::geometry::cs::spherical_equatorial<boost::geometry::degree> > geo_point; typedef boost::geometry::model::segment<geo_point> geo

Having a matrix MxN of integers how to group them into polygons with boost geometry?

自闭症网瘾萝莉.ら 提交于 2019-12-19 10:28:29
问题 We have a matrix of given integers (any from 1 to INT_MAX) like 1 2 3 1 3 3 1 3 3 100 2 1 We want to create polygons with same colors for each unique int in matrix so our polygons would have coords/groupings like shown here. and we could generate image like this: Which *(because of vectirisation that was performed would scale to such size like): (sorry for crappy drawings) Is it possible and how to do such thing with boost geometry? Update: So @sehe sad: I'd simply let Boost Geometry do most

boost::geometry: nearest neighbors using a circle

微笑、不失礼 提交于 2019-12-18 02:48:07
问题 I am using the Rtree implementation of boost::geometry to store (lots of) 2D points. Now I need to do distance-based nearest neigbors queries. However, the manual only describes queries as rectangular boxes (i.e. "Get me all the points that are inside this rectangle") or "KNN" queries ("Get me the nearest 'n' points from here). What I want is actually "Get me the set of points that are at a distance less than 'n'". I noticed that you can define a unary-predicate, but is is... unary (thus, not