-
Notifications
You must be signed in to change notification settings - Fork 26
Open
Labels
DCELDoubly Connected Edge ListDoubly Connected Edge ListbugSomething isn't workingSomething isn't working
Description
The following program:
package main
import (
"fmt"
"github.com/peterstace/simplefeatures/geom"
)
func main() {
a, errA := geom.UnmarshalWKT("MULTIPOLYGON(((-110.957357 32.2328185,-110.957357 32.232822999999996,-110.95735599999999 32.232898,-110.9574775 32.232898,-110.95760999999999 32.232898,-110.957731 32.232898,-110.9577355 32.232898,-110.957866 32.2328985,-110.95786799999999 32.232751,-110.9578705 32.2325175,-110.957872 32.232405,-110.95787349999999 32.232271,-110.957741 32.23227,-110.957628 32.232268999999995,-110.957616 32.232268999999995,-110.95747399999999 32.232268,-110.957473 32.232279,-110.9574715 32.2322905,-110.95746899999999 32.2323015,-110.957466 32.232312,-110.95746199999999 32.232323,-110.95745749999999 32.232333,-110.95745199999999 32.2323435,-110.95744549999999 32.232352999999996,-110.9574385 32.2323625,-110.957431 32.232372,-110.95742249999999 32.2323805,-110.957414 32.2323885,-110.9574045 32.2323965,-110.95739449999999 32.2324035,-110.95738349999999 32.2324105,-110.95737249999999 32.2324165,-110.95736099999999 32.232422,-110.95736 32.2325155,-110.95736 32.2325265,-110.9573575 32.232748,-110.9573575 32.2327485,-110.9573575 32.2327495,-110.957357 32.2327945,-110.957357 32.2328185),(-110.9576385 32.232718,-110.9577245 32.2327185,-110.957724 32.232742,-110.95769449999999 32.232742,-110.95769449999999 32.2327505,-110.9576675 32.2327505,-110.95763799999999 32.232749999999996,-110.957504 32.232749,-110.95750299999999 32.2328245,-110.957471 32.232824,-110.957472 32.232749,-110.9574715 32.2327255,-110.957538 32.232726,-110.9575395 32.2325875,-110.957467 32.232586999999995,-110.95746749999999 32.232561,-110.957601 32.232562,-110.957599 32.2327175,-110.9576385 32.232718),(-110.9577025 32.2323885,-110.957737 32.232389,-110.957737 32.2324045,-110.9577365 32.232474499999995,-110.9577015 32.232474499999995,-110.9577015 32.2324585,-110.9577025 32.232389,-110.9577025 32.2323885)))")
b, errB := geom.UnmarshalWKT("MULTIPOLYGON(((-110.95736 32.2325265,-110.9573575 32.232748,-110.9573575 32.2327485,-110.9573575 32.2327495,-110.957357 32.2327945,-110.957357 32.2328185,-110.957357 32.232822999999996,-110.95735599999999 32.232898,-110.9574775 32.232898,-110.95760999999999 32.232898,-110.957731 32.232898,-110.9577355 32.232898,-110.957866 32.2328985,-110.95786799999999 32.232751,-110.95775549999999 32.232749999999996,-110.95775549999999 32.232787,-110.95773249999999 32.232787,-110.957735 32.232562,-110.95770499999999 32.232562,-110.95770499999999 32.232547499999995,-110.95767649999999 32.232547,-110.95767699999999 32.2325375,-110.957509 32.232537,-110.957484 32.232537,-110.9574835 32.232527499999996,-110.957422 32.232527,-110.9573855 32.2325265,-110.95736 32.2325265),(-110.9576385 32.232718,-110.9577245 32.2327185,-110.957724 32.232742,-110.95769449999999 32.232742,-110.95769449999999 32.2327505,-110.9576675 32.2327505,-110.95763799999999 32.232749999999996,-110.9576385 32.232718)))")
c, errC := geom.UnmarshalWKT("MULTIPOLYGON(((-110.95736 32.2325265,-110.9573575 32.232748,-110.9573575 32.2327485,-110.9573575 32.2327495,-110.957357 32.2327945,-110.957357 32.2328185,-110.957357 32.232822999999996,-110.95735599999999 32.232898,-110.9574775 32.232898,-110.95760999999999 32.232898,-110.957731 32.232898,-110.9577355 32.232898,-110.957866 32.2328985,-110.95786799999999 32.232751,-110.9578705 32.2325175,-110.957872 32.232405,-110.95787349999999 32.232271,-110.957741 32.23227,-110.957628 32.232268999999995,-110.957616 32.232268999999995,-110.95747399999999 32.232268,-110.957473 32.232279,-110.9574715 32.2322905,-110.95746899999999 32.2323015,-110.957466 32.232312,-110.95746199999999 32.232323,-110.95745749999999 32.232333,-110.95745199999999 32.2323435,-110.95744549999999 32.232352999999996,-110.9574385 32.2323625,-110.957431 32.232372,-110.95742249999999 32.2323805,-110.957414 32.2323885,-110.9574045 32.2323965,-110.95739449999999 32.2324035,-110.95738349999999 32.2324105,-110.95737249999999 32.2324165,-110.95736099999999 32.232422,-110.95736 32.2325155,-110.95736 32.2325265)))")
if errA != nil || errB != nil || errC != nil {
panic(fmt.Sprintf("Error unmarshalling WKT: %v, %v, %v", errA, errB, errC))
}
u, err := geom.UnionMany([]geom.Geometry{a, b, c})
if err != nil {
panic(fmt.Sprintf("Error calculating union: %v", err))
}
fmt.Println(u.AsText())
}
Gives an incorrect result:
POLYGON((-110.95786799999999 32.232751,-110.9578705 32.2325175,-110.957872 32.232405,-110.95787349999999 32.232271,-110.957741 32.23227,-110.957628 32.232268999999995,-110.957616 32.232268999999995,-110.95747399999999 32.232268,-110.957473 32.232279,-110.9574715 32.2322905,-110.95746899999999 32.2323015,-110.957466 32.232312,-110.95746199999999 32.232323,-110.95745749999999 32.232333,-110.95745199999999 32.2323435,-110.95744549999999 32.232352999999996,-110.9574385 32.2323625,-110.957431 32.232372,-110.95742249999999 32.2323805,-110.957414 32.2323885,-110.9574045 32.2323965,-110.95739449999999 32.2324035,-110.95738349999999 32.2324105,-110.95737249999999 32.2324165,-110.95736099999999 32.232422,-110.95736 32.2325155,-110.95736 32.2325265,-110.9573575 32.232748,-110.9573575 32.2327485,-110.9573575 32.2327495,-110.957357 32.2327945,-110.957357 32.2328185,-110.957357 32.232822999999996,-110.95735599999999 32.232898,-110.9574775 32.232898,-110.95760999999999 32.232898,-110.957731 32.232898,-110.9577355 32.232898,-110.957866 32.2328985,-110.95786799999999 32.232751),(-110.9577025 32.2323885,-110.957737 32.232389,-110.957737 32.2324045,-110.9577365 32.232474499999995,-110.9577015 32.232474499999995,-110.9577015 32.2324585,-110.9577025 32.232389,-110.9577025 32.2323885),(-110.9576385 32.232718,-110.9577245 32.2327185,-110.957724 32.232742,-110.95769449999999 32.232742,-110.95769449999999 32.2327505,-110.9576675 32.2327505,-110.95763799999999 32.232749999999996,-110.9576385 32.232718))
Metadata
Metadata
Assignees
Labels
DCELDoubly Connected Edge ListDoubly Connected Edge ListbugSomething isn't workingSomething isn't working