|
Geometry : |
Subject: [ggl] Using Dissolve
From: DominikR (inikofdoom)
Date: 2011-11-03 22:04:07
Hi everybody.
My name is Dominik and I'm currently working on a program to convert maps
from a CAD format to our in house map format. This is mostly working well,
but unfortunately, the quality of data is sometimes not as good as it is
supposed to be. Especially corners are very badly done sometimes, causing
self intersections that make my processing chain of various union, xor and
difference steps unusable (throwing lots of exceptions).
As a result I hoped that the dissolve algorithm could help me with these
glitches, but I just can't anything using it to compile properly. I hope
that someone of you can shed some light on this.
I'm using a boost 1.48 beta build found here:
https://launchpad.net/~purplekarrot/+archive/ppa (seems to be from
2011-09-21).
The example I'm trying to compile was found here (and as far as I can see,
it's pretty much what is done in the unit tests):
http://codepad.org/ArAgjZKQ . I stripped it down a bit more:
#include <boost/geometry.hpp>
#include <boost/geometry/extensions/algorithms/dissolve.hpp>
#include <boost/geometry/extensions/multi/algorithms/dissolve.hpp>
#include <boost/geometry/geometries/geometries.hpp>
#include <boost/geometry/multi/geometries/multi_polygon.hpp>
#include <boost/geometry/extensions/gis/io/wkt/wkt.hpp>
int main()
{
typedef boost::geometry::model::d2::point_xy<double> point;
typedef boost::geometry::model::polygon<point> polygon;
typedef boost::geometry::model::multi_polygon<polygon> mp;
mp raw_green, green;
const std::string wkt = "MULTIPOLYGON(((560 -400, 600 -400, 600 -440,
560 -440, 560 -400)), ((480 -400, 520 -400, 520 -440, 480 -440, 480 -400)),
((600 -320, 640 -320, 640 -360, 600 -360, 600 -320)), ((520 -400, 560 -400,
560 -440, 520 -440, 520 -400)))";
boost::geometry::read_wkt(wkt, raw_green);
boost::geometry::dissolve(raw_green, green);
return 0;
}
Trying to compile it (using g++ 4.5.2 on Ubuntu Natty) results in the
following errors:
**** Build of configuration Debug for project testBoostGeometry1 ****
make all
Building file: ../src/testBoostGeometry1.cpp
Invoking: GCC C++ Compiler
g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP
-MF"src/testBoostGeometry1.d" -MT"src/testBoostGeometry1.d" -o
"src/testBoostGeometry1.o" "../src/testBoostGeometry1.cpp"
In file included from ../src/testBoostGeometry1.cpp:6:0:
/usr/include/boost/geometry/extensions/gis/io/wkt/wkt.hpp:21:2: warning:
#warning "wkt is moved to boost/geometry/domains/gis/io/wkt, please update
include file"
In file included from
/usr/include/boost/geometry/algorithms/detail/has_self_intersections.hpp:18:0,
from
/usr/include/boost/geometry/algorithms/detail/overlay/backtrack_check_si.hpp:22,
from
/usr/include/boost/geometry/algorithms/detail/overlay/traverse.hpp:18,
from
/usr/include/boost/geometry/algorithms/detail/overlay/overlay.hpp:25,
from
/usr/include/boost/geometry/algorithms/detail/overlay/intersection_insert.hpp:27,
from
/usr/include/boost/geometry/algorithms/difference.hpp:14,
from /usr/include/boost/geometry/geometry.hpp:47,
from /usr/include/boost/geometry.hpp:17,
from ../src/testBoostGeometry1.cpp:1:
/usr/include/boost/geometry/algorithms/detail/overlay/self_turn_points.hpp:
In member function ?bool
boost::geometry::detail::self_get_turn_points::self_section_visitor<Geometry,
Turns, TurnPolicy, InterruptPolicy>::apply(const Section&, const Section&)
[with Section =
boost::geometry::section<boost::geometry::model::box<boost::geometry::model::d2::point_xy<double>
>, 1u>, Geometry =
boost::geometry::model::polygon<boost::geometry::model::d2::point_xy<double>
>, Turns =
std::vector<boost::geometry::detail::overlay::traversal_turn_info<boost::geometry::model::d2::point_xy<double>
>,
std::allocator<boost::geometry::detail::overlay::traversal_turn_info<boost::geometry::model::d2::point_xy<double>
> > >, TurnPolicy =
boost::geometry::detail::overlay::get_turn_info<boost::geometry::model::d2::point_xy<double>,
boost::geometry::model::d2::point_xy<double>,
boost::geometry::detail::overlay::traversal_turn_info<boost::geometry::model::d2::point_xy<double>
>, boost::geometry::detail::overlay::assign_null_policy>, InterruptPolicy =
boost::geometry::detail::get_turns::no_interrupt_policy]?:
/usr/include/boost/geometry/algorithms/detail/partition.hpp:340:21:
instantiated from ?static void boost::geometry::partition<Box, ExpandPolicy,
OverlapsPolicy, VisitBoxPolicy>::apply(const InputCollection&, VisitPolicy&,
int, VisitBoxPolicy) [with InputCollection =
boost::geometry::sections<boost::geometry::model::box<boost::geometry::model::d2::point_xy<double>
>, 1u>, VisitPolicy =
boost::geometry::detail::self_get_turn_points::self_section_visitor<boost::geometry::model::polygon<boost::geometry::model::d2::point_xy<double>
>,
std::vector<boost::geometry::detail::overlay::traversal_turn_info<boost::geometry::model::d2::point_xy<double>
>,
std::allocator<boost::geometry::detail::overlay::traversal_turn_info<boost::geometry::model::d2::point_xy<double>
> > >,
boost::geometry::detail::overlay::get_turn_info<boost::geometry::model::d2::point_xy<double>,
boost::geometry::model::d2::point_xy<double>,
boost::geometry::detail::overlay::traversal_turn_info<boost::geometry::model::d2::point_xy<double>
>, boost::geometry::detail::overlay::assign_null_policy>,
boost::geometry::detail::get_turns::no_interrupt_policy>, Box =
boost::geometry::model::box<boost::geometry::model::d2::point_xy<double>
>, ExpandPolicy = boost::geometry::detail::get_turns::get_section_box,
OverlapsPolicy = boost::geometry::detail::get_turns::ovelaps_section_box,
VisitBoxPolicy = boost::geometry::visit_no_policy]?
/usr/include/boost/geometry/algorithms/detail/overlay/self_turn_points.hpp:123:13:
instantiated from ?static bool
boost::geometry::detail::self_get_turn_points::get_turns<Geometry, Turns,
TurnPolicy, InterruptPolicy>::apply(const Geometry&, Turns&,
InterruptPolicy&) [with Geometry =
boost::geometry::model::polygon<boost::geometry::model::d2::point_xy<double>
>, Turns =
std::vector<boost::geometry::detail::overlay::traversal_turn_info<boost::geometry::model::d2::point_xy<double>
>,
std::allocator<boost::geometry::detail::overlay::traversal_turn_info<boost::geometry::model::d2::point_xy<double>
> > >, TurnPolicy =
boost::geometry::detail::overlay::get_turn_info<boost::geometry::model::d2::point_xy<double>,
boost::geometry::model::d2::point_xy<double>,
boost::geometry::detail::overlay::traversal_turn_info<boost::geometry::model::d2::point_xy<double>
>, boost::geometry::detail::overlay::assign_null_policy>, InterruptPolicy =
boost::geometry::detail::get_turns::no_interrupt_policy]?
/usr/include/boost/geometry/algorithms/detail/overlay/self_turn_points.hpp:277:5:
instantiated from ?void boost::geometry::self_turns(const Geometry&, Turns&,
InterruptPolicy&) [with AssignPolicy =
boost::geometry::detail::overlay::calculate_distance_policy, Geometry =
boost::geometry::model::polygon<boost::geometry::model::d2::point_xy<double>
>, Turns =
std::vector<boost::geometry::detail::overlay::traversal_turn_info<boost::geometry::model::d2::point_xy<double>
>,
std::allocator<boost::geometry::detail::overlay::traversal_turn_info<boost::geometry::model::d2::point_xy<double>
> > >, InterruptPolicy =
boost::geometry::detail::get_turns::no_interrupt_policy]?
/usr/include/boost/geometry/extensions/algorithms/dissolve.hpp:95:9:
instantiated from ?static OutputIterator
boost::geometry::detail::dissolve::dissolve_ring_or_polygon<Geometry,
GeometryOut>::apply(const Geometry&, OutputIterator) [with OutputIterator =
std::back_insert_iterator<std::vector<boost::geometry::model::polygon<boost::geometry::model::d2::point_xy<double>
>,
std::allocator<boost::geometry::model::polygon<boost::geometry::model::d2::point_xy<double>
> > > >, Geometry =
boost::geometry::model::polygon<boost::geometry::model::d2::point_xy<double>
>, GeometryOut =
boost::geometry::model::polygon<boost::geometry::model::d2::point_xy<double>
>]?
/usr/include/boost/geometry/extensions/multi/algorithms/dissolve.hpp:49:13:
instantiated from ?static OutputIterator
boost::geometry::detail::dissolve::dissolve_multi<Multi,
GeometryOut>::apply(const Multi&, OutputIterator) [with OutputIterator =
std::back_insert_iterator<boost::geometry::model::multi_polygon<boost::geometry::model::polygon<boost::geometry::model::d2::point_xy<double>
> > >, Multi =
boost::geometry::model::multi_polygon<boost::geometry::model::polygon<boost::geometry::model::d2::point_xy<double>
> >, GeometryOut =
boost::geometry::model::polygon<boost::geometry::model::d2::point_xy<double>
>]?
/usr/include/boost/geometry/extensions/algorithms/dissolve.hpp:266:5:
instantiated from ?void boost::geometry::dissolve(const Geometry&,
Collection&) [with Geometry =
boost::geometry::model::multi_polygon<boost::geometry::model::polygon<boost::geometry::model::d2::point_xy<double>
> >, Collection =
boost::geometry::model::multi_polygon<boost::geometry::model::polygon<boost::geometry::model::d2::point_xy<double>
> >]?
../src/testBoostGeometry1.cpp:17:47: instantiated from here
/usr/include/boost/geometry/algorithms/detail/overlay/self_turn_points.hpp:76:9:
error: ?struct boost::geometry::detail::get_turns::no_interrupt_policy? has
no member named ?has_intersections?
make: *** [src/testBoostGeometry1.o] Error 1
**** Build Finished ****
If I change the program to use polygons instead of multi polygons (which is
actually closer to what I need):
#include <boost/geometry.hpp>
#include <boost/geometry/extensions/algorithms/dissolve.hpp>
#include <boost/geometry/extensions/multi/algorithms/dissolve.hpp>
#include <boost/geometry/geometries/geometries.hpp>
#include <boost/geometry/extensions/gis/io/wkt/wkt.hpp>
int main()
{
typedef boost::geometry::model::d2::point_xy<double> point;
typedef boost::geometry::model::polygon<point> polygon;
polygon rawgreen, green;
boost::geometry::read_wkt( "POLYGON((2 1.3,2.4 1.7,2.8 1.8,3.4 1.2,3.7
1.6,3.4 2,4.1 3,5.3 2.6,5.4 1.2,4.9 0.8,2.9 0.7,2 1.3)"
"(4.0 2.0, 4.2 1.4, 4.8 1.9, 4.4
2.2, 4.0 2.0))", rawgreen);
boost::geometry::dissolve(rawgreen, green);
return 0;
}
..., I get the following errors:
**** Build of configuration Debug for project testBoostGeometry1 ****
make all
Building file: ../src/testBoostGeometry1.cpp
Invoking: GCC C++ Compiler
g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP
-MF"src/testBoostGeometry1.d" -MT"src/testBoostGeometry1.d" -o
"src/testBoostGeometry1.o" "../src/testBoostGeometry1.cpp"
In file included from ../src/testBoostGeometry1.cpp:5:0:
/usr/include/boost/geometry/extensions/gis/io/wkt/wkt.hpp:21:2: warning:
#warning "wkt is moved to boost/geometry/domains/gis/io/wkt, please update
include file"
In file included from /usr/include/boost/aligned_storage.hpp:24:0,
from /usr/include/boost/type_traits/aligned_storage.hpp:11,
from /usr/include/boost/type_traits.hpp:20,
from /usr/include/boost/geometry/core/cs.hpp:19,
from /usr/include/boost/geometry/geometry.hpp:20,
from /usr/include/boost/geometry.hpp:17,
from ../src/testBoostGeometry1.cpp:1:
/usr/include/boost/mpl/eval_if.hpp: In instantiation of
?boost::mpl::eval_if_c<false,
boost::range_const_iterator<boost::geometry::model::polygon<boost::geometry::model::d2::point_xy<double>
> >,
boost::range_mutable_iterator<boost::geometry::model::polygon<boost::geometry::model::d2::point_xy<double>
> > >?:
/usr/include/boost/range/iterator.hpp:63:63: instantiated from
?boost::range_iterator<boost::geometry::model::polygon<boost::geometry::model::d2::point_xy<double>
> >?
/usr/include/boost/range/value_type.hpp:31:5: instantiated from
?boost::range_value<boost::geometry::model::polygon<boost::geometry::model::d2::point_xy<double>
> >?
/usr/include/boost/geometry/extensions/algorithms/dissolve.hpp:262:59:
instantiated from ?void boost::geometry::dissolve(const Geometry&,
Collection&) [with Geometry =
boost::geometry::model::polygon<boost::geometry::model::d2::point_xy<double>
>, Collection =
boost::geometry::model::polygon<boost::geometry::model::d2::point_xy<double>
>]?
../src/testBoostGeometry1.cpp:16:46: instantiated from here
/usr/include/boost/mpl/eval_if.hpp:60:31: error: no type named ?type? in
?struct boost::mpl::eval_if_c<false,
boost::range_const_iterator<boost::geometry::model::polygon<boost::geometry::model::d2::point_xy<double>
> >,
boost::range_mutable_iterator<boost::geometry::model::polygon<boost::geometry::model::d2::point_xy<double>
> > >::f_?
In file included from ../src/testBoostGeometry1.cpp:2:0:
/usr/include/boost/geometry/extensions/algorithms/dissolve.hpp: In function
?void boost::geometry::dissolve(const Geometry&, Collection&) [with Geometry
=
boost::geometry::model::polygon<boost::geometry::model::d2::point_xy<double>
>, Collection =
boost::geometry::model::polygon<boost::geometry::model::d2::point_xy<double>
>]?:
../src/testBoostGeometry1.cpp:16:46: instantiated from here
/usr/include/boost/geometry/extensions/algorithms/dissolve.hpp:262:59:
error: no type named ?type? in ?struct
boost::range_value<boost::geometry::model::polygon<boost::geometry::model::d2::point_xy<double>
> >?
/usr/include/boost/geometry/extensions/algorithms/dissolve.hpp:266:5: error:
no type named ?type? in ?struct
boost::range_value<boost::geometry::model::polygon<boost::geometry::model::d2::point_xy<double>
> >?
In file included from /usr/include/c++/4.5/bits/stl_algobase.h:69:0,
from /usr/include/c++/4.5/bits/char_traits.h:41,
from /usr/include/c++/4.5/ios:41,
from /usr/include/c++/4.5/istream:40,
from /usr/include/c++/4.5/sstream:39,
from /usr/include/c++/4.5/complex:47,
from /usr/include/boost/type_traits/is_complex.hpp:12,
from /usr/include/boost/type_traits.hpp:46,
from /usr/include/boost/geometry/core/cs.hpp:19,
from /usr/include/boost/geometry/geometry.hpp:20,
from /usr/include/boost/geometry.hpp:17,
from ../src/testBoostGeometry1.cpp:1:
/usr/include/c++/4.5/bits/stl_iterator.h: At global scope:
/usr/include/c++/4.5/bits/stl_iterator.h: In instantiation of
?std::back_insert_iterator<boost::geometry::model::polygon<boost::geometry::model::d2::point_xy<double>
> >?:
/usr/include/boost/geometry/extensions/algorithms/dissolve.hpp:266:5:
instantiated from ?void boost::geometry::dissolve(const Geometry&,
Collection&) [with Geometry =
boost::geometry::model::polygon<boost::geometry::model::d2::point_xy<double>
>, Collection =
boost::geometry::model::polygon<boost::geometry::model::d2::point_xy<double>
>]?
../src/testBoostGeometry1.cpp:16:46: instantiated from here
/usr/include/c++/4.5/bits/stl_iterator.h:421:7: error: no type named
?const_reference? in ?class
boost::geometry::model::polygon<boost::geometry::model::d2::point_xy<double>
>?
make: *** [src/testBoostGeometry1.o] Error 1
**** Build Finished ****
Any ideas? Is there something wrong with my installation?
Thanks in advance,
Dominik
-- View this message in context: http://boost-geometry.203548.n3.nabble.com/Using-Dissolve-tp3476751p3476751.html Sent from the Boost Geometry mailing list archive at Nabble.com.
Geometry list run by mateusz at loskot.net