How do I add a KML file as an overlay when the code generating the Google Maps view is as follows:
<script type="text/javascript">
jQuery(document).ready(function($){
jQuery('#google_map_1').gMap({
zoom:7,
markers:[{
address:'',
开发者_开发知识库 latitude:51.486782,
longitude:-0.143242,
html:'London, United Kingdom',
popup:true
}],
controls:[],
maptype:G_NORMAL_MAP,
scrollwheel:false
});
});
var road = new google.maps.KmlLayer(
'http://MUST-BE-A-WEBSITE.com/myfile.kml',
{preserveViewport:true}
);
road.setMap(map);
typically like that - watch out for that huge gotcha though - must be a website NOT a file served from localhost, somewhere that Google can parse, analyse and integrate it with their maptiles. Also, this example is gmaps v3 only. Other stuff to watch out for - including a list of KML gotchas.
精彩评论