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

incorrect result from wktToPolygon #310

Open
SamMaxwell opened this issue Sep 21, 2024 · 1 comment
Open

incorrect result from wktToPolygon #310

SamMaxwell opened this issue Sep 21, 2024 · 1 comment

Comments

@SamMaxwell
Copy link

wktToPolygon(
'POLYGON(-83.094492 39.965258, -83.093337 39.963332, -83.095068 39.963332, -83.095977 39.965155, -83.094492 39.965258)'
)

yields an incorrect initial point [
{ longitude: 83.094492, latitude: 39.965258 },
{ longitude: -83.093337, latitude: 39.963332 },
{ longitude: -83.095068, latitude: 39.963332 },
{ longitude: -83.095977, latitude: 39.965155 },
{ longitude: -83.094492, latitude: 39.965258 }
]

(the longitude should be negative)

@SamMaxwell
Copy link
Author

I use this function for that purpose (it isn't validating, it simply picks out the coordinates)

const getPoints = (polygon) =>
  polygon
    .match(/(-?\d+\.\d+)\s+(-?\d+\.\d+)/g)
    .map((pair) => pair.split(' ').map(Number));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant