讀取 KML 顯示路徑

KML 檔案路徑必須位於 Google 可存取的外部網路位址。
$('#map-kml-01').tinyMap({
    'kml': [
        {
            'url': 'https://maps.google.com.tw/maps/ms?authuser=0&vps=3&gl=tw&brcurrent=h3,0x346ef3065c07572f:0xe711f004bf9c5469&ie=UTF8&msa=0&output=kml&msid=211638096894483184187.0004e0743b42ed2befe27',
            'event': function () {
                console.dir(this);
            }
        }
    ]
});

將目前的圖層輸出為 KML

<div id="map-kml-02"></div>
<div id="kml-info"></div>
var map = $('#map-kml-02');

map.tinyMap({
    'center': ['25.037627167884715', '121.56732559204102'],
    'zoom'  : 13,
    'marker': [
        {'addr': ['25.037627167884715', '121.56732559204102']},
        {'addr': ['25.039726809855434', '121.55633926391602']}
    ],
    'polyline': [
        {
            'coords': [
                ['25.05176362315452', '121.54683386230465'],
                ['25.0587614830369', '121.55301367187496'],
                ['25.05673992011185', '121.56005178833004'],
            ],
            'color': '#008800',
            'width': 4
        }
    ],
    'event': {
        'idle': function () {
            $('#kml-info').text(map.tinyMap('getKML'));
        }
    }
});

留言 Comments

comments powered by Disqus