I have a string with a list of polygon coordinates in the following format:
var myString = "(38.35870116756209, 38.27089903372614),(38.3339292947434, 38.2743322612652),(38.33944984782068, 38.3017980815777),(38.35829734627614, 38.297678208530826)";
I want to convert that string to an array with lat / lng coordinates, like this:
const polygonCoords = [
{ lat: 38.35870116756209, lng: 38.27089903372614 },
{ lat: 38.3339292947434, lng: 38.2743322612652 },
{ lat: 38.33944984782068, lng: 38.3017980815777 },
{ lat: 38.35829734627614, lng: 38.297678208530826 },
{ lat: 38.35870116756209, lng: 38.27089903372614 } // first coordinate again
];
How can I do this?