<?php
$str = '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))';
function array_final($str)
{
$arrays = [];
for($i = 0; $i < count($str); $i += 2) {
$arrays[] = ['lat' => $str[$i], 'lng' => $str[$i+1]];
}
return $arrays;
}
PD9waHAKCiRzdHIgPSAnUE9MWUdPTigoLTIyLjg4NjE0NTQ1NzgzNjQ2MyAtNDMuMTE4NzY0MDk3ODM1LCAtMjIuODg2NDMyMTAwOTY5ODcgLTQzLjExODMyNDIxNTU1NjU1NSwgLTIyLjg4NjY5NDAzMjk1OSAtNDMuMTE3ODQ2NzgyMzUxOTA0LCAtMjIuODg2NzYzMjIyNDU2NjM2IC00My4xMTc2NzUxMjA5NzQ5NiwgLTIyLjg4Njc4Mjk5MDg3ODA0NiAtNDMuMTE3NjA1MzgzNTQwNTY0LCAtMjIuODg2ODg2Nzc1MDQzMjM3IC00My4xMTc2Mzc1NzAwNDg3NSwgLTIyLjg4NzEzMzg3OTg3OTA3MyAtNDMuMTE4OTE5NjY1OTU3ODcsIC0yMi44ODYzMDM2MDU4NDY5OSAtNDMuMTE5NDIzOTIxMjUyNjcsIC0yMi44ODYxMTU4MDUwNjM5NjYgLTQzLjExODgyMzEwNjQzMzMyNSwgLTIyLjg4NjE0NTQ1NzgzNjQ2MyAtNDMuMTE4NzY0MDk3ODM1KSknOwoKZnVuY3Rpb24gYXJyYXlfZmluYWwoJHN0cikKewoJJHN0ciA9IHN0cl9yZXBsYWNlKFsnUE9MWUdPTicsJygoJywnKSknXSwgWycnXSwgJHN0cik7Cgkkc3RyID0gZXhwbG9kZSgiICIsIHRyaW0oJHN0cikpOwoJJGFycmF5cyA9IFtdOwoJZm9yKCRpID0gMDsgJGkgPCBjb3VudCgkc3RyKTsgJGkgKz0gMikKCXsKCQkkYXJyYXlzW10gPSBbJ2xhdCcgPT4gJHN0clskaV0sICdsbmcnID0+ICRzdHJbJGkrMV1dOwoJfQoJcmV0dXJuICRhcnJheXM7Cn0KCnZhcl9kdW1wKGFycmF5X2ZpbmFsKCRzdHIpKTs=
array(10) {
[0]=>
array(2) {
["lat"]=>
string(19) "-22.886145457836463"
["lng"]=>
string(17) "-43.118764097835,"
}
[1]=>
array(2) {
["lat"]=>
string(18) "-22.88643210096987"
["lng"]=>
string(20) "-43.118324215556555,"
}
[2]=>
array(2) {
["lat"]=>
string(16) "-22.886694032959"
["lng"]=>
string(20) "-43.117846782351904,"
}
[3]=>
array(2) {
["lat"]=>
string(19) "-22.886763222456636"
["lng"]=>
string(19) "-43.11767512097496,"
}
[4]=>
array(2) {
["lat"]=>
string(19) "-22.886782990878046"
["lng"]=>
string(20) "-43.117605383540564,"
}
[5]=>
array(2) {
["lat"]=>
string(19) "-22.886886775043237"
["lng"]=>
string(19) "-43.11763757004875,"
}
[6]=>
array(2) {
["lat"]=>
string(19) "-22.887133879879073"
["lng"]=>
string(19) "-43.11891966595787,"
}
[7]=>
array(2) {
["lat"]=>
string(18) "-22.88630360584699"
["lng"]=>
string(19) "-43.11942392125267,"
}
[8]=>
array(2) {
["lat"]=>
string(19) "-22.886115805063966"
["lng"]=>
string(20) "-43.118823106433325,"
}
[9]=>
array(2) {
["lat"]=>
string(19) "-22.886145457836463"
["lng"]=>
string(16) "-43.118764097835"
}
}