国产久_亚欧精品一区_久久亚洲美女_99精品在线观看_日韩成人三级_久久精品久久久久

BIGEMPA Js API示例中心

導(dǎo)入KML源代碼展示

代碼編輯區(qū) 運(yùn)行 下載 還原
<!DOCTYPE html>
<html>
<head>
    <meta charset='UTF-8' />
    <meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
    <!--
        以下CSS地址請在安裝軟件了替換成本地的地址
        CSS地址請使用:
        http://localhost:9000/bigemap.js/v2.1.0/bigemap.css
        軟件下載地址 http://www.bt68f.cn/reader/download/detail201802017.html
    -->
    <link href="http://ua.bigemap.com:30081/bmsdk/bigemap.js/v2.1.0/bigemap.css" rel="stylesheet"/>
    <link href="http://www.bt68f.cn/Public/css/button.min.css" rel="stylesheet">
    <!--
        JS地址請使用:
        http://localhost:9000/bigemap.js/v2.1.0/bigemap.js
    -->
    <script src="http://ua.bigemap.com:30081/bmsdk/bigemap.js/v2.1.0/bigemap.js"></script>
    <!--
        引入加載KML的JS插件
    -->
    <script type="text/javascript" src="http://www.bt68f.cn/mapoffline/js/togeojson.js"></script>


    <style>
        body { margin: 0; padding: 0; }
        #map { position: absolute; top: 0; bottom: 0; width: 100%; }
        .tool{
            position: absolute;
            z-index: 10;
            right: 10px;
            top:60px;
        }
        .info{
            position: fixed;
            top:40px;
            color: #8a6d3b;
            z-index: 99;
            margin: 0;
            background-color: #fcf8e3;
            border-color: #faebcc;
            left: 0;
            right: 0;
            text-align: center;
        }
    </style>
    <title>切換圖層</title>
</head>
<body>
<p class="info">
    數(shù)據(jù)保存在本地,刷新會消失,僅僅用作測試
</p>
<p class="tool">
    <a id="satellite" class="button button-tiny button-rounded button-primary" href="javascript:void (0);">導(dǎo)入KML</a>
    <a id="export" class="button button-tiny button-rounded button-primary" download="geojson.geojson" href="javascript:void (0);">導(dǎo)出GeoJSON</a>
    <input type="file" accept=".kml" style="display: none" id="upload">
</p>
<div id='map'></div>
<script src="http://www.bt68f.cn/Public/common/js/jquery.min.js"></script>
<script type="text/javascript">// 軟件配置信息地址,軟件安裝完成之后使用本地地址,如:http://localhost:9000
BM.Config.HTTP_URL = "http://ua.bigemap.com:30081/bmsdk/"
// 在ID為map的元素中實(shí)例化一個地圖,并設(shè)置地圖的ID號為 bigemap.baidu-map,ID號程序自動生成,無需手動配置,并設(shè)置地圖的投影為百度地圖 ,中心點(diǎn),默認(rèn)的級別和顯示級別控件
var map = BM.map('map', 'bigemap.dc-tian-w-satellite', {
center: [ 30,104], 
zoom: 3,
zoomControl: true,
attributionControl:false,
    preferCanvas: true,//適用于數(shù)據(jù)量大時 地圖反應(yīng)速度加快
});
var geo;
//創(chuàng)建一個谷歌衛(wèi)星圖層 ,具體API詳情請參見 :http://www.bt68f.cn/offlinemaps/api/#tilelayer
$('#upload').on('change',function () {
    var file=this.files[0];
    var extension=file.name.split('.');
    var name=extension[0];
    extension=extension.pop();
    if (extension!=='kml'){
        alert('只能是KML格式');
        return;
    }
    var reader=new FileReader();
    reader.readAsText(file);
    reader.onload=function () {
        var dom= (new DOMParser()).parseFromString(this.result, 'text/xml');
        var geojsonFeature=toGeoJSON.kml(dom);
        var blob=new Blob([JSON.stringify(geojsonFeature)]);
        var href=URL.createObjectURL(blob);
        $('#export').prop('href',href);
        $('#export').prop('download',`${name}.geojson`);
        geo=BM.geoJSON(geojsonFeature,{
            style: function (feature) {
                // return {color: feature.properties.stroke};
            },
             onEachFeature:function (feature,layer) {
                feature.properties&&feature.properties.name&&layer.bindTooltip(feature.properties.name,{direction:'bottom',className:'my_tooltip',permanent:true});
            }
        }).addTo(map);
        map.fitBounds(geo.getBounds());
    }
});
$('#satellite').on('click',function () {
    $('#upload').click();
});

</script>
</body>
</html>                                                                                                                                                                                                                                                                                                                                                                                                                        
主站蜘蛛池模板: 成人国产午夜在线观看 | 孕妇av在线 | xxxxx欧美| 亚洲 欧美 激情 另类 校园 | 亚洲欧美中日精品高清一区二区 | 日韩精品一区二区三区在线观看视频网站 | 中文字幕一区二区三三 | 国产精品嫩草影院ccm | 91影视网| 特级毛片av | 日韩一区二区三区在线免费观看 | 噜噜噜av久久av牛牛 | 狠狠干干干| 中午字幕在线观看 | 日韩专区欧美专区 | 干干日日| 在线中文字幕亚洲 | 欧美激情在线观看一区二区三区 | 国产孕妇孕交大片孕 | 亚洲自拍偷拍一区二区 | 精品国产一区二区在线观看 | 91精品国产91热久久久做人人 | 亚洲网站免费看 | 少妇一级淫片50分钟v | 欧美视频免费在线观看 | 好吊日精品视频 | 可以看毛片的网站 | 高清不卡一区二区三区 | 亚洲宅男天堂 | 成年人在线免费 | 国产91在线亚洲 | 国外处破女一区二区 | 日韩av网址在线观看 | 久久riav| 自拍偷拍第二页 | 婷婷天天 | 欧美亚洲天堂网 | 色老板网址 | 欧美日韩一二三 | 91精品国产综合久久久密闭 | 国产一级片在线 |