开发者

Add KML file as overlay to Google maps window

开发者 https://www.devze.com 2023-03-04 13:08 出处:网络
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\">

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号