pbootcms网站模板|日韩1区2区|织梦模板||网站源码|日韩1区2区|jquery建站特效-html5模板网

<tfoot id='9vj07'></tfoot>
  • <i id='9vj07'><tr id='9vj07'><dt id='9vj07'><q id='9vj07'><span id='9vj07'><b id='9vj07'><form id='9vj07'><ins id='9vj07'></ins><ul id='9vj07'></ul><sub id='9vj07'></sub></form><legend id='9vj07'></legend><bdo id='9vj07'><pre id='9vj07'><center id='9vj07'></center></pre></bdo></b><th id='9vj07'></th></span></q></dt></tr></i><div class="00aycu2" id='9vj07'><tfoot id='9vj07'></tfoot><dl id='9vj07'><fieldset id='9vj07'></fieldset></dl></div>

    <legend id='9vj07'><style id='9vj07'><dir id='9vj07'><q id='9vj07'></q></dir></style></legend>

    <small id='9vj07'></small><noframes id='9vj07'>

          <bdo id='9vj07'></bdo><ul id='9vj07'></ul>
      1. 將傳單地圖導出到 geojson

        Export leaflet map to geojson(將傳單地圖導出到 geojson)
            <tbody id='OjJqd'></tbody>
          <tfoot id='OjJqd'></tfoot>

        • <i id='OjJqd'><tr id='OjJqd'><dt id='OjJqd'><q id='OjJqd'><span id='OjJqd'><b id='OjJqd'><form id='OjJqd'><ins id='OjJqd'></ins><ul id='OjJqd'></ul><sub id='OjJqd'></sub></form><legend id='OjJqd'></legend><bdo id='OjJqd'><pre id='OjJqd'><center id='OjJqd'></center></pre></bdo></b><th id='OjJqd'></th></span></q></dt></tr></i><div class="m228wae" id='OjJqd'><tfoot id='OjJqd'></tfoot><dl id='OjJqd'><fieldset id='OjJqd'></fieldset></dl></div>
            <bdo id='OjJqd'></bdo><ul id='OjJqd'></ul>

                <small id='OjJqd'></small><noframes id='OjJqd'>

                  <legend id='OjJqd'><style id='OjJqd'><dir id='OjJqd'><q id='OjJqd'></q></dir></style></legend>
                  本文介紹了將傳單地圖導出到 geojson的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  是否可以從傳單中導出 geojson 以保存地圖狀態?

                  Is it possible to export geojson from leaflet to save the map state?

                  我想存儲標記、縮放和地圖中心稍后加載.

                  I want to store the markers, zoom & map center to load it later.

                  有很多方法可以在傳單上加載 geojson,但我想不出任何將地圖導出到 geojson 的選項...

                  There is plenty of ways to load geojson on leaflet, but I can't figure out any option to export the map to geojson...

                  推薦答案

                  沒有開箱即用"的選項可以將地圖上的所有標記導出到 GeoJSON,但您可以自己輕松完成.Leaflet 的 L.Marker 有一個 toGeoJSON 方法:

                  There's no "out-of-the-box" option to export all the markers on the map to GeoJSON but it's something you can do easily do yourself. Leaflet's L.Marker has a toGeoJSON method:

                  返回標記的 GeoJSON 表示(GeoJSON 點特征).

                  Returns a GeoJSON representation of the marker (GeoJSON Point Feature).

                  http://leafletjs.com/reference.html#marker-togeojson

                  例如:

                  // Create a marker
                  var marker = new L.Marker([0, 0]);
                  // Get the GeoJSON object
                  var geojson = marker.toGeoJSON();
                  // Log to console
                  console.log(geojson);
                  

                  將輸出到您的控制臺:

                  {
                      "type":"Feature",
                      "properties":{},
                      "geometry":{
                          "type":"Point",
                          "coordinates":[0,0]
                      }
                  }
                  

                  如果您想將添加到地圖中的所有標記存儲在 GeoJSON 集合中,您可以執行以下操作:

                  If you want to store all the markers added to your map in a GeoJSON collection, you could do something like this:

                  // Adding some markers to the map
                  var markerA = new L.Marker([0, 0]).addTo(map),
                      markerB = new L.Marker([1, 1]).addTo(map),
                      markerC = new L.Marker([2, 2]).addTo(map),
                      markerD = new L.Marker([3, 3]).addTo(map);
                  
                  // Create an empty GeoJSON collection
                  var collection = {
                      "type": "FeatureCollection",
                      "features": []
                  };
                  
                  // Iterate the layers of the map
                  map.eachLayer(function (layer) {
                      // Check if layer is a marker
                      if (layer instanceof L.Marker) {
                          // Create GeoJSON object from marker
                          var geojson = layer.toGeoJSON();
                          // Push GeoJSON object to collection
                          collection.features.push(geojson);
                      }
                  });
                  
                  // Log GeoJSON collection to console
                  console.log(collection);
                  

                  將輸出到您的控制臺:

                  {
                      "type":"FeatureCollection",
                      "features":[{
                          "type":"Feature",
                          "properties":{},
                          "geometry":{
                              "type":"Point",
                              "coordinates":[0,0]
                          }
                      },{
                          "type":"Feature",
                          "properties":{},
                          "geometry":{
                              "type":"Point",
                              "coordinates":[1,1]
                          }
                      },{
                          "type":"Feature",
                          "properties":{},
                          "geometry":{
                              "type":"Point",
                              "coordinates":[2,2]
                          }
                      },{
                          "type":"Feature",
                          "properties":{},
                          "geometry":{
                              "type":"Point",
                              "coordinates":[3,3]
                          }
                      }]
                  }
                  

                  編輯:但是,正如 QP 發現的那樣,如果您能夠將標記放入 L.LayerGroupL.FeatureGroupL.GeoJSON 層,你可以使用它的 toGeoJSON 方法,它返回一個 GeoJSON 特征集合:

                  Edit: However, as the QP found out, if you're able to put your markers into a L.LayerGroup, L.FeatureGroup or L.GeoJSON layer you can just use it's toGeoJSON method which returns a GeoJSON featurecollection:

                  返回圖層組的 GeoJSON 表示 (GeoJSON FeatureCollection).

                  Returns a GeoJSON representation of the layer group (GeoJSON FeatureCollection).

                  http://leafletjs.com/reference.html#layergroup-togeojson

                  如果您想存儲地圖的當前邊界(中心和縮放),您只需將其添加到集合中即可:

                  If you want to store the map's current bounds (center and zoom) you could simply add it to the collection doing this:

                  var bounds = map.getBounds();
                  
                  var collection = {
                      "type": "FeatureCollection",
                      "bbox": [[
                          bounds.getSouthWest().lng,
                          bounds.getSouthWest().lat
                      ], [
                          bounds.getNorthEast().lng,
                          bounds.getNorthEast().lat
                      ]],
                      "features": []
                  };
                  

                  您可以稍后將 bbox 成員與 L.MapsetBounds 方法結合使用來恢復它.而已.您可以將其發送到服務器或通過 dataurl 下載任何您喜歡的內容.希望對你有幫助,祝你好運.

                  You can later restore it by using the bbox member in conjunction with L.Map's setBounds method. That's it. You could send it to the server or download it via dataurl whatever you like. Hope that helps, good luck.

                  這篇關于將傳單地圖導出到 geojson的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  Check if a polygon point is inside another in leaflet(檢查一個多邊形點是否在傳單中的另一個內部)
                  Changing leaflet markercluster icon color, inheriting the rest of the default CSS properties(更改傳單標記群集圖標顏色,繼承其余默認 CSS 屬性)
                  Trigger click on leaflet marker(觸發點擊傳單標記)
                  How can I change the default loading tile color in LeafletJS?(如何更改 LeafletJS 中的默認加載磁貼顏色?)
                  Add external geojson to leaflet layer(將外部geojson添加到傳單層)
                  Adding Leaflet layer control to sidebar(將 Leaflet 圖層控件添加到側邊欄)

                            <tbody id='3DoLp'></tbody>

                          <small id='3DoLp'></small><noframes id='3DoLp'>

                          • <bdo id='3DoLp'></bdo><ul id='3DoLp'></ul>

                            <legend id='3DoLp'><style id='3DoLp'><dir id='3DoLp'><q id='3DoLp'></q></dir></style></legend>

                          • <i id='3DoLp'><tr id='3DoLp'><dt id='3DoLp'><q id='3DoLp'><span id='3DoLp'><b id='3DoLp'><form id='3DoLp'><ins id='3DoLp'></ins><ul id='3DoLp'></ul><sub id='3DoLp'></sub></form><legend id='3DoLp'></legend><bdo id='3DoLp'><pre id='3DoLp'><center id='3DoLp'></center></pre></bdo></b><th id='3DoLp'></th></span></q></dt></tr></i><div class="eiumswa" id='3DoLp'><tfoot id='3DoLp'></tfoot><dl id='3DoLp'><fieldset id='3DoLp'></fieldset></dl></div>
                            <tfoot id='3DoLp'></tfoot>
                            主站蜘蛛池模板: 钢化玻璃膜|手机钢化膜|钢化膜厂家|手机保护膜-【东莞市大象电子科技有限公司】 | 钢格板|镀锌钢格板|热镀锌钢格板|格栅板|钢格板|钢格栅板|热浸锌钢格板|平台钢格板|镀锌钢格栅板|热镀锌钢格栅板|平台钢格栅板|不锈钢钢格栅板 - 专业钢格板厂家 | 比亚迪叉车-比亚迪电动叉车堆垛车托盘车仓储叉车价格多少钱报价 磁力去毛刺机_去毛刺磁力抛光机_磁力光饰机_磁力滚抛机_精密金属零件去毛刺机厂家-冠古科技 | 二手电脑回收_二手打印机回收_二手复印机回_硒鼓墨盒回收-广州益美二手电脑回收公司 | 山东PE给水管厂家,山东双壁波纹管,山东钢带增强波纹管,山东PE穿线管,山东PE农田灌溉管,山东MPP电力保护套管-山东德诺塑业有限公司 | 圆周直径尺-小孔内视镜-纤维研磨刷-东莞市高腾达精密工具 | 千斤顶,液压千斤顶-力良企业,专业的液压千斤顶制造商,shliliang.com | 圣才学习网-考研考证学习平台,提供万种考研考证电子书、题库、视频课程等考试资料 | 石膏基自流平砂浆厂家-高强石膏基保温隔声自流平-轻质抹灰石膏粉砂浆批发-永康市汇利建设有限公司 | 回转支承-转盘轴承-回转驱动生产厂家-洛阳隆达轴承有限公司 | 上海办公室装修,写字楼装修—启鸣装饰设计工程有限公司 | 存包柜厂家_电子存包柜_超市存包柜_超市电子存包柜_自动存包柜-洛阳中星 | 合肥废气治理设备_安徽除尘设备_工业废气处理设备厂家-盈凯环保 合肥防火门窗/隔断_合肥防火卷帘门厂家_安徽耐火窗_良万消防设备有限公司 | 洗地机_全自动洗地机_手推式洗地机【上海滢皓环保】 | 球磨机 选矿球磨机 棒磨机 浮选机 分级机 选矿设备厂家 | 衬塑管道_衬四氟管道厂家-淄博恒固化工设备有限公司 | 金属回收_废铜废铁回收_边角料回收_废不锈钢回收_废旧电缆线回收-广东益夫金属回收公司 | 焊接烟尘净化器__焊烟除尘设备_打磨工作台_喷漆废气治理设备 -催化燃烧设备 _天津路博蓝天环保科技有限公司 | 二手光谱仪维修-德国OBLF光谱仪|进口斯派克光谱仪-热电ARL光谱仪-意大利GNR光谱仪-永晖检测 | 密度电子天平-内校-外校电子天平-沈阳龙腾电子有限公司 | 宁夏档案密集柜,智能密集柜,电动手摇密集柜-盛隆柜业宁夏档案密集柜厂家 | 专业广州网站建设,微信小程序开发,一物一码和NFC应用开发、物联网、外贸商城、定制系统和APP开发【致茂网络】 | 济南轻型钢结构/济南铁艺护栏/济南铁艺大门-济南燕翔铁艺制品有限公司 | 啤酒设备-小型啤酒设备-啤酒厂设备-济南中酿机械设备有限公司 | 长春网站建设,五合一网站设计制作,免费优化推广-长春网站建设 | 芜湖厨房设备_芜湖商用厨具_芜湖厨具设备-芜湖鑫环厨具有限公司 控显科技 - 工控一体机、工业显示器、工业平板电脑源头厂家 | 翻斗式矿车|固定式矿车|曲轨侧卸式矿车|梭式矿车|矿车配件-山东卓力矿车生产厂家 | 悬浮拼装地板_篮球场木地板翻新_运动木地板价格-上海越禾运动地板厂家 | 深圳APP开发_手机软件APP定制外包_小程序开发公司-来科信 | 武汉天安盾电子设备有限公司 - 安盾安检,武汉安检门,武汉安检机,武汉金属探测器,武汉测温安检门,武汉X光行李安检机,武汉防爆罐,武汉车底安全检查,武汉液体探测仪,武汉安检防爆设备 | 浴室柜-浴室镜厂家-YINAISI · 意大利设计师品牌 | 咿耐斯 |-浙江台州市丰源卫浴有限公司 | MOOG伺服阀维修,ATOS比例流量阀维修,伺服阀维修-上海纽顿液压设备有限公司 | 南京办公用品网-办公文具用品批发-打印机耗材采购 | Duoguan 夺冠集团| 温泉机设备|温泉小镇规划设计|碳酸泉设备 - 大连连邦温泉科技 | 韦伯电梯有限公司| 压片机_高速_单冲_双层_花篮式_多功能旋转压片机-上海天九压片机厂家 | 固诺家居-全屋定制十大品牌_整体衣柜木门橱柜招商加盟 | (中山|佛山|江门)环氧地坪漆,停车场地板漆,车库地板漆,聚氨酯地板漆-中山永旺地坪漆厂家 | 耐磨陶瓷,耐磨陶瓷管道_厂家-淄博拓创陶瓷科技 | 医用空气消毒机-医用管路消毒机-工作服消毒柜-成都三康王 |