I was wondering if someone could give me a hand.
I have a KML file (Google Maps XML) and I need to extract the coordinates to a 2D array.
The format of the file is as follows:
<?xml version="1.0" encoding="UTF-8"?>
<kml
xmlns="http://earth.google.com/kml/2.1">
<Document>
<Placemark>
<name>Im a name</name>
<Point>
<coordinates>138.611798,-34.926053</coordinates>
</Point>
</Placemark>
<Placemark>
<name>Im a name</name>
<Point>
<coordinates>138.611798,-34.926053</coordinates>
</Point>
</Placemark>
<Placemark>
<name>Im a name</name>
<Point>
<coordinates>138.611798,-34.926053</coordinates>
</Point>
</Placemark>
[...]
I need to be able to return an array with the following format:
Array
(
[0] => Array
(
[0] => 138.611798
[1] => -34.926053
)
[1] => Array
(
[0] => 138.611798
[1] => -34.926053
)
My KML file will contain quite a few points so I need to be able to do this automatically.
Any help would be really appreciated.
Thanks