Boost logo

Geometry :

Subject: [geometry] Union points gives empty result
From: Minipada (minipada_at_[hidden])
Date: 2015-07-16 06:32:57


Hello, I am trying to union 2 polygons, I got an error:
  what(): Boost.Geometry Overlay invalid input exception

I read this post:
http://boost-geometry.203548.n3.nabble.com/overlay-invalid-input-exception-td3688234.html

but I still have no answers on how to solve it

1) Do I need to keep points order ? (At least clockwise or counterclockwise)
2) If so, correct functions is not solving it ?
3) Is there a limit of points for the algorithm ?
4) Or is it because it is detecting self interceptions (even if I don't)

These are my polygons:

boost::geometry::read_wkt("POLYGON((50 54,50 59,50 64,49 69,49 74,48 79,47
83,45 88,44 93,43 97,42 102,41 107,40 112,40 116,39 121,39 126,39 131,40
136,40 140,41 145,42 150,44 154,45 159,47 163,49 168,51 172,53 177,55 181,57
185,57 189,58 193,58 198,58 203,58 208,59 213,59 218,59 223,59 228,60 233,61
238,62 242,63 246,65 250,67 254,69 257,72 260,75 263,79 265,82 267,86 269,90
270,94 271,98 271,102 271,106 270,111 269,115 267,120 266,125 264,129
263,134 263,138 263,143 263,147 263,152 264,156 266,161 268,165 269,170
271,174 271,179 272,183 272,187 271,192 270,196 269,200 267,205 265,210
263,214 262,219 261,224 260,228 260,233 260,238 261,243 261,247 262,252
264,257 265,262 265,267 266,272 267,276 268,281 269,286 270,291 270,296
271,301 271,306 271,311 271,316 271,321 270,325 270,330 269,335 267,339
266,343 264,347 262,351 259,354 256,357 253,360 250,362 246,365 242,366
238,368 234,369 230,369 225,370 220,371 215,372 210,374 205,375 201,377
196,377 192,378 187,378 183,378 179,377 174,376 170,374 166,372 161,371
157,369 152,368 147,367 142,367 137,367 132,367 127,368 122,368 117,367
113,367 109,366 105,364 101,362 97,360 94,358 91,355 88,351 85,348 83,344
81,340 80,335 78,331 76,326 73,322 71,318 68,314 65,311 61,307 59,303 56,299
54,295 52,291 51,287 50,282 50,277 50,272 49,267 49,262 48,257 48,252 47,248
48,243 48,238 49,233 50,228 51,223 51,219 52,214 51,209 51,204 49,200 48,195
47,190 46,185 45,181 44,176 43,171 42,166 41,162 39,157 38,152 37,147 36,143
35,138 34,133 33,128 32,124 30,119 29,114 28,110 27,105 26,100 25,95 24))",
green);

boost::geometry::read_wkt("POLYGON((236 25,240 25,244 25,232 26,247 26,251
27,227 28,255 28,98 29,103 29,107 29,157 29,161 29,165 29,170 29,223 29,112
30,117 30,152 30,175 30,259 30,122 31,127 31,147 31,179 31,218 31,132 32,137
32,142 32,184 32,213 32,263 32,189 33,208 33,194 34,199 34,204 34,268 34,272
36,277 38,281 40,286 42,291 43,296 43,315 43,320 43,323 43,301 44,305 44,310
44,326 44,329 45,332 46,335 48,337 50,339 53,340 55,342 58,50 59,343 61,50
64,343 64,344 67,50 69,344 72,50 74,344 77,50 79,344 82,50 84,344 87,50
89,344 92,50 94,344 97,50 99,344 102,50 104,344 107,50 109,344 112,50
113,344 117,50 118,51 122,344 122,52 127,345 127,54 131,345 132,56 135,345
137,59 139,345 142,61 144,345 147,64 148,66 152,345 152,69 156,345 157,71
161,345 161,72 166,345 166,73 170,345 171,74 175,344 176,75 180,344 181,75
185,344 186,74 190,344 191,74 194,344 196,72 199,345 201,71 204,345 205,70
208,344 210,69 213,344 214,68 218,342 219,68 223,341 223,339 227,68 228,337
231,69 233,335 235,69 237,333 239,70 242,330 242,327 244,72 247,324 247,321
249,73 251,317 251,245 252,249 252,254 252,258 252,263 252,268 252,313
252,240 253,273 253,277 253,282 253,309 253,75 254,287 254,292 254,297
254,302 254,306 254,236 255,77 257,232 257,228 259,80 260,224 261,143
262,148 262,153 262,83 263,138 263,158 263,134 264,163 264,220 264,86
265,167 265,129 266,172 266,89 267,124 267,216 267,176 268,92 269,120
269,212 269,96 270,181 270,100 271,111 271,115 271,185 271,209 271,104
272,107 272,189 272,201 272,205 272,193 273,197 273))", blue);

        boost::geometry::correct(blue);
        boost::geometry::correct(green);

        std::vector<polygon> output_p;
        boost::geometry::union_(blue, green, output_p);

I really don't know where to begin to solve it

--
View this message in context: http://boost-geometry.203548.n3.nabble.com/Union-points-gives-empty-result-tp4026618.html
Sent from the Boost Geometry mailing list archive at Nabble.com.

Geometry list run by mateusz at loskot.net