Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TransformXY doesn't preserve coordinates type for some empty collections #439

Closed
peterstace opened this issue Jan 26, 2022 · 0 comments
Closed
Assignees
Labels
bug Something isn't working

Comments

@peterstace
Copy link
Owner

The following program exhibits the buggy behaviour:

package main

import (
    "fmt"

    "github.com/peterstace/simplefeatures/geom"
)

func main() {
    tx("POLYGON Z EMPTY")
    tx("MULTILINESTRING Z EMPTY")
    tx("MULTIPOINT Z EMPTY")
    tx("GEOMETRYCOLLECTION Z EMPTY")
}

func must(err error) {
    if err != nil {
        panic(err)
    }
}

func tx(wkt string) {
    g, err := geom.UnmarshalWKT(wkt)
    must(err)
    t, err := g.TransformXY(func(in geom.XY) geom.XY { return in })
    must(err)
    fmt.Println(t.AsText())
}

Outputs:

POLYGON Z EMPTY
MULTILINESTRING EMPTY
MULTIPOINT EMPTY
GEOMETRYCOLLECTION Z EMPTY

The correct output should be:

POLYGON Z EMPTY
MULTILINESTRING Z EMPTY
MULTIPOINT Z EMPTY
GEOMETRYCOLLECTION Z EMPTY
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant