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

      • <bdo id='Ar2Yt'></bdo><ul id='Ar2Yt'></ul>

    1. <legend id='Ar2Yt'><style id='Ar2Yt'><dir id='Ar2Yt'><q id='Ar2Yt'></q></dir></style></legend>
      <i id='Ar2Yt'><tr id='Ar2Yt'><dt id='Ar2Yt'><q id='Ar2Yt'><span id='Ar2Yt'><b id='Ar2Yt'><form id='Ar2Yt'><ins id='Ar2Yt'></ins><ul id='Ar2Yt'></ul><sub id='Ar2Yt'></sub></form><legend id='Ar2Yt'></legend><bdo id='Ar2Yt'><pre id='Ar2Yt'><center id='Ar2Yt'></center></pre></bdo></b><th id='Ar2Yt'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='Ar2Yt'><tfoot id='Ar2Yt'></tfoot><dl id='Ar2Yt'><fieldset id='Ar2Yt'></fieldset></dl></div>

        <tfoot id='Ar2Yt'></tfoot>

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

        如何將要在地圖上顯示的文本添加到傳單中的

        how to add text for display on map to a geojson object in leaflet(如何將要在地圖上顯示的文本添加到傳單中的 geojson 對(duì)象)

        • <small id='0HfYF'></small><noframes id='0HfYF'>

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

            <legend id='0HfYF'><style id='0HfYF'><dir id='0HfYF'><q id='0HfYF'></q></dir></style></legend>

                • 本文介紹了如何將要在地圖上顯示的文本添加到傳單中的 geojson 對(duì)象的處理方法,對(duì)大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                  問題描述

                  所以我在傳單中有一個(gè) geojson 圖層,我可以將 geojson 對(duì)象添加到該圖層以顯示在生成的地圖上.

                  So I have a geojson layer in leaflet, and I can add geojson objects to this layer for display on the resulting map.

                  現(xiàn)在我想添加一個(gè)文本標(biāo)簽以顯示在對(duì)象附近.

                  Now I'd like to add a text label to display near the object.

                  本示例展示了使用自定義 L.control() 對(duì)象在地圖上顯示附加信息.這似乎接近我想做的事情.

                  This example shows use of a custom L.control() object to display additional info on the map. Which seems close to what I want to do.

                  鑒于此示例,我想在每個(gè)狀態(tài)上添加狀態(tài)初始文本標(biāo)簽(即TX"、FL").L.control() 可以用來做這個(gè)嗎,還是有別的方法?

                  Given this example, I'd like to add State initial text labels (i.e. "TX", "FL") positioned over each state. Can L.control() be used to do this, or is there another way?

                  http://leaflet.cloudmade.com/examples/choropleth.html

                  var info = L.control();
                  
                  info.onAdd = function (map) {
                      this._div = L.DomUtil.create('div', 'info'); // create a div with a class "info"
                      this.update();
                      return this._div;
                  };
                  
                  // method that we will use to update the control based on feature properties passed
                  info.update = function (props) {
                      this._div.innerHTML = '<h4>US Population Density</h4>' +  (props ?
                          '<b>' + props.name + '</b><br />' + props.density + ' people / mi<sup>2</sup>'
                          : 'Hover over a state');
                  };
                  
                  info.addTo(map);
                  

                  推薦答案

                  我最近也在找同樣的問題,昨天剛剛根據(jù)google群里的帖子實(shí)現(xiàn)了.https://groups.google.com/forum/#!topic/leaflet-js/sA2HnU5W9Fw

                  I was looking for the same question recently and just implemented it yesterday based on a posting in the google group. https://groups.google.com/forum/#!topic/leaflet-js/sA2HnU5W9Fw

                  感謝 Adrian 提供原始代碼示例.

                  Thanks to Adrian for the original code sample.

                  解決辦法如下:

                  擴(kuò)展如下類:

                  <script>
                  
                      L.LabelOverlay = L.Class.extend({
                          initialize: function(/*LatLng*/ latLng, /*String*/ label, options) {
                              this._latlng = latLng;
                              this._label = label;
                              L.Util.setOptions(this, options);
                          },
                          options: {
                              offset: new L.Point(0, 2)
                          },
                          onAdd: function(map) {
                              this._map = map;
                              if (!this._container) {
                                  this._initLayout();
                              }
                              map.getPanes().overlayPane.appendChild(this._container);
                              this._container.innerHTML = this._label;
                              map.on('viewreset', this._reset, this);
                              this._reset();
                          },
                          onRemove: function(map) {
                              map.getPanes().overlayPane.removeChild(this._container);
                              map.off('viewreset', this._reset, this);
                          },
                          _reset: function() {
                              var pos = this._map.latLngToLayerPoint(this._latlng);
                              var op = new L.Point(pos.x + this.options.offset.x, pos.y - this.options.offset.y);
                              L.DomUtil.setPosition(this._container, op);
                          },
                          _initLayout: function() {
                              this._container = L.DomUtil.create('div', 'leaflet-label-overlay');
                          }
                      });   
                  
                  </script>
                  

                  另外添加這個(gè)css:

                  <style>
                      .leaflet-popup-close-button {
                          display:none;
                      }
                  
                      .leaflet-label-overlay {
                          line-height:0px;
                          margin-top: 9px;
                          position:absolute;
                      }
                  </style>
                  

                  然后顯示文本標(biāo)簽如下:

                  And then display the text labels as below:

                  <script>
                      var map = L.map('map').setView([51.898712, 6.7307100000001], 4);
                  
                      // add markers
                      // ...
                  
                      // add text labels:
                      var labelLocation = new L.LatLng(51.329219337279405, 10.454119349999928);
                      var labelTitle = new L.LabelOverlay(labelLocation, '<b>GERMANY</b>');
                      map.addLayer(labelTitle);
                  
                  
                      var labelLocation2 = new L.LatLng(47.71329162782909, 13.34573480000006);
                      var labelTitle2 = new L.LabelOverlay(labelLocation2, '<b>AUSTRIA</b>');
                      map.addLayer(labelTitle2);
                  
                      // In order to prevent the text labels to "jump" when zooming in and out,
                      // in Google Chrome, I added this event handler:
                  
                      map.on('movestart', function () {
                          map.removeLayer(labelTitle);
                          map.removeLayer(labelTitle2);
                      });
                      map.on('moveend', function () {
                          map.addLayer(labelTitle);
                          map.addLayer(labelTitle2);
                      });
                  </script>
                  

                  結(jié)果:

                  這篇關(guān)于如何將要在地圖上顯示的文本添加到傳單中的 geojson 對(duì)象的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

                  相關(guān)文檔推薦

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

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

                            <tfoot id='qQzBp'></tfoot>

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

                            主站蜘蛛池模板: 国产精品久久av | 99热精品在线 | 国产亚洲欧美在线 | 亚洲一区二区三区免费观看 | 亚洲一区在线日韩在线深爱 | 久久99蜜桃综合影院免费观看 | 国产午夜精品一区二区三区 | 亚洲视屏| 欧美精品一区二区在线观看 | 久久久久中文字幕 | 91精品国产一区二区三区 | 国产精品一区二区三区在线 | 国产成人综合一区二区三区 | 7777在线视频 | 一区二区在线不卡 | 一区二区三区在线免费看 | 蜜桃av人人夜夜澡人人爽 | 成人久久18免费网站 | 中文字幕在线免费观看 | 综合九九| 久久伊人操 | 欧美在线视频网 | www.日日干 | 伊人亚洲 | 国产精品久久久久久吹潮日韩动画 | 久久久综合网 | 一区二区三区日韩精品 | 欧美成人一区二区 | 国产午夜精品一区二区 | 亚洲精品成人av久久 | 亚洲精品一区二区三区在线观看 | 日韩精品久久久久 | 一二区视频| 欧美精品综合在线 | 亚洲视频第一页 | 最新国产精品视频 | 国产小视频自拍 | 色黄爽 | 日本精品一区二区 | 国产一区不卡 | 欧美精品区 |