久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

<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="qwawimqqmiuu" 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="qwawimqqmiuu" 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="qwawimqqmiuu" id='3DoLp'><tfoot id='3DoLp'></tfoot><dl id='3DoLp'><fieldset id='3DoLp'></fieldset></dl></div>
                            <tfoot id='3DoLp'></tfoot>
                            主站蜘蛛池模板: 欧美激情视频一区二区三区免费 | 91综合在线视频 | 日韩欧美高清dvd碟片 | 天天夜碰日日摸日日澡 | 欧美精品一区在线发布 | 成人免费视频网站在线看 | 免费精品视频 | 亚洲国产精品一区在线观看 | 久久久久久国产 | 欧美国产日韩一区 | 国产成人精品久久二区二区91 | 日本一区二区三区视频在线 | www.亚洲精品 | 国产高清在线精品一区二区三区 | 99精品国产一区二区三区 | 另类一区 | 亚洲精品中文字幕在线观看 | 精品乱码一区二区三四区视频 | 久久看片| 天天干狠狠操 | 日韩精品久久久 | 四虎国产 | 九九热在线视频 | 久久久999国产精品 中文字幕在线精品 | 久草资源网站 | 亚洲高清在线播放 | 久久综合婷婷 | 粉嫩在线 | 成人精品一区二区户外勾搭野战 | 最新av在线播放 | 六月成人网 | 午夜在线小视频 | 国产精品久久久久一区二区三区 | 精品九九九 | 新91视频网 | 国产精品国产精品 | 天天综合久久 | 精品国产一区二区三区免费 | www精品美女久久久tv | 99热在线播放 | 精品一区二区三区四区外站 |