Last active
December 15, 2015 19:09
-
-
Save giorrrgio/5308824 to your computer and use it in GitHub Desktop.
JSON TO KML
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
include('php-kml/lib/kml.php'); | |
$jsonFile = file_get_contents("data.json"); | |
$json_a = json_decode($jsonFile, true); | |
$a = new kml_Document(); | |
$a->set_id('uid000000111'); | |
foreach ($json_a as $poi) { | |
$myPlacemark = new kml_Placemark($poi['title']); | |
$myPlacemark->set_description($poi['html']); | |
$myPlacemark->set_Geometry(new kml_Point($poi['longitude'], $poi['latitude'])); | |
$a->add_Feature($myPlacemark); | |
} | |
$a->dump(false); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"latitude": "48.86491238118212", | |
"longitude": "2.3293590545654297", | |
"title": "My title", | |
"html": "Description" | |
} | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment