Created
June 8, 2014 17:17
-
-
Save michalsn/4196517ed44b1d4b7f93 to your computer and use it in GitHub Desktop.
Load KML file using geoxml3
This file contains 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
<kml xmlns="http://www.opengis.net/kml/2.2"> | |
<Document> | |
<?php foreach ($suburbs as $suburb): ?> | |
<Placemark> | |
<name><?php echo $suburb->suburb; ?></name> | |
<?php echo $suburb->geometry; ?> | |
</Placemark> | |
<?php endforeach; ?> | |
</Document> | |
</kml> |
This file contains 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
<script type="text/javascript" src="<?php echo base_url('js/geoxml3.js'); ?>"></script> | |
<script type="text/javascript" src="https://maps-api-ssl.google.com/maps/api/js?sensor=false"></script> | |
<script type="text/javascript"> | |
var geoXml, map = null; | |
function initialize() { | |
var mapOptions = { | |
zoom: 11 | |
} | |
map = new google.maps.Map(document.getElementById('map_canvas'), mapOptions); | |
geoXml = new geoXML3.parser({ | |
map: map | |
}); | |
geoXml.parse('<?php echo site_url("url/to/kml/file"); ?>'); | |
} | |
$(function() { | |
google.maps.event.addDomListener(window, 'load', initialize); | |
}); | |
</script> | |
<div id="map_canvas" style="width:100%; height: 600px;"></div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment