Last active
April 24, 2021 04:53
Star
You must be signed in to star a gist
Shows how to add a KML file to a Participants Database Locations Map map.
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
<?php | |
// adds a KML to a a Google Map | |
add_filter( 'pdbgmap-additional_map_code', 'xnau_add_kml' ); | |
/** | |
* adds a KML file to the map configuration | |
* | |
* this is based on the example at Google | |
* @see https://developers.google.com/maps/documentation/javascript/kml | |
* @param string $js_object empty string | |
* @return string a valid JS object | |
*/ | |
function xnau_add_kml( $js_object ) { | |
return ' | |
var src = "https://developers.google.com/maps/documentation/javascript/examples/kml/westcampus.kml"; | |
var kmlLayer = new google.maps.KmlLayer(src, { | |
suppressInfoWindows: true, | |
preserveViewport: false, | |
map: map | |
}); | |
'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment