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

      • <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="k2kgs2c" 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 對象)

        • <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="usyiuaq" 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 對象的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

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

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

                  現在我想添加一個文本標簽以顯示在對象附近.

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

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

                  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.

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

                  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);
                  

                  推薦答案

                  我最近也在找同樣的問題,昨天剛剛根據google群里的帖子實現了.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.

                  解決辦法如下:

                  擴展如下類:

                  <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>
                  

                  另外添加這個css:

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

                  然后顯示文本標簽如下:

                  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>
                  

                  結果:

                  這篇關于如何將要在地圖上顯示的文本添加到傳單中的 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 圖層控件添加到側邊欄)
                  <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="cyqwmyq" 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'>

                            主站蜘蛛池模板: 创绿家招商加盟网-除甲醛加盟-甲醛治理加盟-室内除甲醛加盟-创绿家招商官网 | 振动传感器,检波器-威海广达勘探仪器有限公司 | 长沙网站建设制作「网站优化推广」-网页设计公司-速马科技官网 | 福州仿石漆加盟_福建仿石漆厂家-外墙仿石漆加盟推荐铁壁金钢(福建)新材料科技有限公司有保障 | 气体检测仪-氢气检测仪-可燃气体传感器-恶臭电子鼻-深国安电子 | 山东氧化铁红,山东铁红-淄博科瑞化工有限公司 | 土壤水分自动监测站-SM150便携式土壤水分仪-铭奥仪器 | 注浆压力变送器-高温熔体传感器-矿用压力传感器|ZHYQ朝辉 | 股票入门基础知识_股票知识_股票投资大师_格雷厄姆网 | 【365公司转让网】公司求购|转让|资质买卖_股权转让交易平台 | 黑田精工电磁阀-CAMMOZI气缸-ROSS电磁-上海茂硕机械设备有限公司 | 环讯传媒,永康网络公司,永康网站建设,永康小程序开发制作,永康网站制作,武义网页设计,金华地区网站SEO优化推广 - 永康市环讯电子商务有限公司 | 长沙中央空调维修,中央空调清洗维保,空气能热水工程,价格,公司就找维小保-湖南维小保环保科技有限公司 | 铝板冲孔网,不锈钢冲孔网,圆孔冲孔网板,鳄鱼嘴-鱼眼防滑板,盾构走道板-江拓数控冲孔网厂-河北江拓丝网有限公司 | 铣刨料沥青破碎机-沥青再生料设备-RAP热再生混合料破碎筛分设备 -江苏锡宝重工 | 福建珂朗雅装饰材料有限公司「官方网站」 | 防勒索软件_数据防泄密_Trellix(原McAfee)核心代理商_Trellix(原Fireeye)售后-广州文智信息科技有限公司 | 东莞压铸厂_精密压铸_锌合金压铸_铝合金压铸_压铸件加工_东莞祥宇金属制品 | 单柱拉力机-橡胶冲片机-哑铃裁刀-江都轩宇试验机械厂 | 环氧树脂地坪_防静电地坪漆_环氧地坪漆涂料厂家-地壹涂料地坪漆 环球电气之家-中国专业电气电子产品行业服务网站! | 电动卫生级调节阀,电动防爆球阀,电动软密封蝶阀,气动高压球阀,气动对夹蝶阀,气动V型调节球阀-上海川沪阀门有限公司 | 英思科GTD-3000EX(美国英思科气体检测仪MX4MX6)百科-北京嘉华众信科技有限公司 | 盐水蒸发器,水洗盐设备,冷凝结晶切片机,转鼓切片机,絮凝剂加药系统-无锡瑞司恩机械有限公司 | 小青瓦丨古建筑瓦丨青瓦厂家-宜兴市徽派古典建筑材料有限公司 | 福尔卡(北京)新型材料技术股份有限公司 | 体感VRAR全息沉浸式3D投影多媒体展厅展会游戏互动-万展互动 | 贝壳粉涂料-内墙腻子-外墙腻子-山东巨野七彩贝壳漆业中心 | 【法利莱住人集装箱厂家】—活动集装箱房,集装箱租赁_大品牌,更放心 | 液压扳手-高品质液压扳手供应商 - 液压扳手, 液压扳手供应商, 德国进口液压拉马 | 耐破强度测试仪-纸箱破裂强度试验机-济南三泉中石单品站 | 泰国试管婴儿_泰国第三代试管婴儿_泰国试管婴儿费用/多少钱_孕泰来 | 电线电缆厂家|沈阳电缆厂|电线厂|沈阳英联塑力线缆有限公司 | 洛阳装修公司-洛阳整装一站式品牌-福尚云宅装饰 | 南京租车,南京汽车租赁,南京包车,南京会议租车-南京七熹租车 | 洗石机-移动滚筒式,振动,螺旋,洗矿机-青州冠诚重工机械有限公司 | 超声波破碎仪-均质乳化机(供应杭州,上海,北京,广州,深圳,成都等地)-上海沪析实业有限公司 | 深圳办公室装修-写字楼装修设计-深圳标榜装饰公司 | 英超直播_英超免费在线高清直播_英超视频在线观看无插件-24直播网 | 运动木地板厂家_体育木地板安装_篮球木地板选购_实木运动地板价格 | 海德莱电力(HYDELEY)-无功补偿元器件生产厂家-二十年专业从事电力电容器 | 找培训机构_找学习课程_励普教育 |