Open SamMaxwell opened 1 month ago
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));
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)