paulmach / orb

Types and utilities for working with 2d geometry in Golang
MIT License
886 stars 103 forks source link

fix windows CRLF line endings for wkt.Unmarshal functions #151

Open mrwormhole opened 2 months ago

mrwormhole commented 2 months ago

currently wkt.UnmarhsalPolygon works with

POLYGON ((
    -0.982 51.941,
    -0.982 52.078,
    -1.05 52.078,
    -1.05 51.941,
    -0.982 51.941
))

but if the file is read and passed as it is, line endings are \r\n (on windows) so if you try this will fail, I can not display as it is but above can be written with \n or \r\n line endings

Linux LF endings (works)

"POLYGON ((\n -0.982 51.941,\n -0.982 52.078,\n -1.05 52.078,\n -1.05 51.941,\n -0.982 51.941\n))"

windows CRLF endings (returns an error)

"POLYGON ((\r\n -0.982 51.941,\r\n -0.982 52.078,\r\n -1.05 52.078,\r\n -1.05 51.941,\r\n -0.982 51.941\r\n))"

Note: I can create a fix PR, let me know what you think