Skip to content

Instantly share code, notes, and snippets.

@heathcliff
Created December 3, 2014 23:12
Show Gist options
  • Save heathcliff/1c02a2c899fe4fe0dbc7 to your computer and use it in GitHub Desktop.
Save heathcliff/1c02a2c899fe4fe0dbc7 to your computer and use it in GitHub Desktop.
KML Traverse
<?php
header('Content-Type: text/plain');
$file = 'path/to/file.kml';
$array = (array) simplexml_load_file($file);
echo "Title\n";
foreach ($array['Document']->Placemark as $pm) {
$name = (string) $pm->name;
$description = (string) $pm->description;
echo trim($name . ' ' . $description) . "\n";
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment