I get a string from the database this way:
POLYGON((-22.886145457836463 -43.118764097835, -22.88643210096987 -43.118324215556555, -22.886694032959 -43.117846782351904, -22.886763222456636 -43.11767512097496, -22.886782990878046 -43.117605383540564, -22.886886775043237 -43.11763757004875, -22.887133879879073 -43.11891966595787, -22.88630360584699 -43.11942392125267, -22.886115805063966 -43.118823106433325, -22.886145457836463 -43.118764097835))
I need only the coordinates between parentheses:
-22.886145457836463 -43.118764097835, -22.88643210096987 -43.118324215556555, -22.886694032959 -43.117846782351904, -22.886763222456636 -43.11767512097496, -22.886782990878046 -43.117605383540564, -22.886886775043237 -43.11763757004875, -22.887133879879073 -43.11891966595787, -22.88630360584699 -43.11942392125267, -22.886115805063966 -43.118823106433325, -22.886145457836463 -43.118764097835
With the Coordinates, I need to create an array:
{lat: -22.886145457836463, lng: -43.118764097835},
{lat: -22.88643210096987, lng: -43.118324215556555},
{lat: -22.886694032959, lng: -43.117846782351904}
and etc ...
How do I do it?