BIGEMPA Js API示例中心

                導入KML源代碼展示

                代碼編輯區 運行 下載 還原
                <!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.xawiki.com/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.xawiki.com/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.xawiki.com/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">
                    數據保存在本地,刷新會消失,僅僅用作測試
                </p>
                <p class="tool">
                    <a id="satellite" class="button button-tiny button-rounded button-primary" href="javascript:void (0);">導入KML</a>
                    <a id="export" class="button button-tiny button-rounded button-primary" download="geojson.geojson" href="javascript:void (0);">導出GeoJSON</a>
                    <input type="file" accept=".kml" style="display: none" id="upload">
                </p>
                <div id='map'></div>
                <script src="http://www.xawiki.com/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的元素中實例化一個地圖,并設置地圖的ID號為 bigemap.baidu-map,ID號程序自動生成,無需手動配置,并設置地圖的投影為百度地圖 ,中心點,默認的級別和顯示級別控件
                var map = BM.map('map', 'bigemap.dc-satellite', {
                crs: BM.CRS.EPSG4326,
                center: [ 30,104], 
                zoom: 3,
                zoomControl: true,
                attributionControl:false,
                    preferCanvas: true,//適用于數據量大時 地圖反應速度加快
                });
                var geo;
                //創建一個谷歌衛星圖層 ,具體API詳情請參見 :http://www.xawiki.com/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>                                                                                                                                                                                                                                                                                                                                                                                                                        
                主站蜘蛛池模板: 精品无码一区二区三区水蜜桃| 99久久99这里只有免费费精品| 欧美亚洲国产视频| 四虎澳门永久8848在线影院| 456在线视频| 天天做天天爱天天综合网| 久久精品无码一区二区www| 永久在线毛片免费观看| 又大又黄又粗又爽的免费视频| 4hu四虎最新免费地址| 国产麻豆va精品视频| 一级毛片a免费播放王色| 日韩a级片在线观看| 亚洲国产美女在线观看| 一日本道a高清免费播放| 最近中文字幕高清字幕在线视频| 亲密爱人之无限诱惑| 老熟女五十路乱子交尾中出一区| 国产激情无码一区二区三区| a在线观看免费| 成年黄网站色大免费全看| 九九久久精品国产AV片国产| 欧美黑人疯狂性受xxxxx喷水| 十八在线观观看免费视频| 青青青国产精品视频| 国产精品成人va在线观看| mm131嫩王语纯翘臀| 拍拍拍又黄又爽无挡视频免费 | 成人美女黄网站视频大全| 亚洲AV无码专区亚洲AV不卡| 欧美精品hdvideosex| 伊甸园在线观看国产| 精品国产国产综合精品| 国产三级在线观看视频不卡| 国产1000部成人免费视频| 国产精品手机视频一区二区| 99久久久国产精品免费牛牛 | 两个人看的www免费视频| 日本人的色道www免费一区| 亚洲AV无码成人精品区在线观看 | 亚洲精品老司机|