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

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

<legend id='LSYci'><style id='LSYci'><dir id='LSYci'><q id='LSYci'></q></dir></style></legend>

    <tfoot id='LSYci'></tfoot>

        <bdo id='LSYci'></bdo><ul id='LSYci'></ul>

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

        使用 Leaflet.js 和 OSM 時僅顯示美國

        Show only United States when using Leaflet.js and OSM(使用 Leaflet.js 和 OSM 時僅顯示美國)
        1. <legend id='vsbMK'><style id='vsbMK'><dir id='vsbMK'><q id='vsbMK'></q></dir></style></legend>
        2. <small id='vsbMK'></small><noframes id='vsbMK'>

          <tfoot id='vsbMK'></tfoot>

              <bdo id='vsbMK'></bdo><ul id='vsbMK'></ul>

                <tbody id='vsbMK'></tbody>
                • <i id='vsbMK'><tr id='vsbMK'><dt id='vsbMK'><q id='vsbMK'><span id='vsbMK'><b id='vsbMK'><form id='vsbMK'><ins id='vsbMK'></ins><ul id='vsbMK'></ul><sub id='vsbMK'></sub></form><legend id='vsbMK'></legend><bdo id='vsbMK'><pre id='vsbMK'><center id='vsbMK'></center></pre></bdo></b><th id='vsbMK'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='vsbMK'><tfoot id='vsbMK'></tfoot><dl id='vsbMK'><fieldset id='vsbMK'></fieldset></dl></div>
                  本文介紹了使用 Leaflet.js 和 OSM 時僅顯示美國的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我正在使用 Leaflet.js 和 OSM 圖塊來創建地圖,但我只希望看到美國大陸,而不是整個世界.這可能嗎?

                  I'm using leaflet.js and OSM tiles to create a map, but I'd only like the continental United States to be viewable, not the entire world. Is that possible?

                  我正在像這樣加載地圖:

                  I'm loading the map like this:

                  var map = L.map('map').setView([39.82, -98.58], 5);
                  
                  L.tileLayer('http://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}.png', {
                      attribution: '...',
                      maxZoom: 18
                  }).addTo(map);
                  

                  推薦答案

                  這是可能的,而且很容易做到.首先,您需要美國大陸邊界框(最外邊緣)的坐標.你可以用谷歌搜索它們,我在這里找到它們:http://isithackday.com/geoplanet-explorer/index.php?woeid=24865672 您需要西南和東北坐標來創建邊界對象:

                  That's possible and easy to do. First of you'll need the coordinates for the bounding box (the outermost edges) of the continental united states. You can just google them, i found them here: http://isithackday.com/geoplanet-explorer/index.php?woeid=24865672 You need the southwest and northeast coordinates to create a bounds object:

                  var maxBounds = L.latLngBounds(
                      L.latLng(5.499550, -167.276413), //Southwest
                      L.latLng(83.162102, -52.233040)  //Northeast
                  );
                  

                  或者您可以使用簡寫版本,即嵌套數組:

                  Or you can go for the shorthand version, a nested array:

                  var maxBounds = [
                      [5.499550, -167.276413], //Southwest
                      [83.162102, -52.233040]  //Northeast
                  ];
                  

                  現在您可以通過兩種方式在地圖上設置它們,初始化時,使用 maxBounds 選項和 L.MapfitBounds 方法>

                  Now you can set those on your map in two ways, upon initialization, using the maxBounds option and the fitBounds method of L.Map

                  L.map('map', {
                      'center': [0, 0],
                      'zoom': 0
                      'maxBounds': maxBounds
                  }).fitBounds(maxBounds);
                  

                  這是一個關于 Plunker 的工作示例:http://plnkr.co/edit/eEsxeh?p=預覽

                  Here's a working example on Plunker: http://plnkr.co/edit/eEsxeh?p=preview

                  或者當您的地圖已經初始化時,您可以使用 L.MapsetMaxBounds 方法和 fitBounds 方法.(假設您的地圖已分配給變量 map):

                  Or when your map is already initialized you can use the setMaxBounds method and the fitBounds method of L.Map. (assuming your map is assigned to variable map):

                  map.setMaxBounds(maxBounds);
                  map.fitBounds(maxBounds);
                  

                  這是一個關于 Plunker 的工作示例:http://plnkr.co/edit/HJKk0O?p=預覽

                  Here's a working example on Plunker: http://plnkr.co/edit/HJKk0O?p=preview

                  這篇關于使用 Leaflet.js 和 OSM 時僅顯示美國的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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 圖層控件添加到側邊欄)

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

                          <tbody id='8QNCK'></tbody>
                        <legend id='8QNCK'><style id='8QNCK'><dir id='8QNCK'><q id='8QNCK'></q></dir></style></legend>
                          • <bdo id='8QNCK'></bdo><ul id='8QNCK'></ul>

                            <small id='8QNCK'></small><noframes id='8QNCK'>

                          • <tfoot id='8QNCK'></tfoot>
                          • 主站蜘蛛池模板: 草久在线 | 韩日一区 | 亚洲精品第一页 | 岛国av在线免费观看 | 亚洲高清免费视频 | 密室大逃脱第六季大神版在线观看 | 欧美一级三级在线观看 | 一区二区三区免费在线观看 | 国产精久久久久久久妇剪断 | 黑人性hd | 精品成人一区二区 | 国产成人免费在线观看 | 欧美在线资源 | 国产精品精品视频一区二区三区 | 欧美日韩国产一区二区三区不卡 | 天堂网av在线 | 在线不卡视频 | 伊人青青久久 | 欧美激情综合 | av中文天堂 | 亚洲国产免费 | 国产午夜一级 | 色偷偷人人澡人人爽人人模 | 日韩精品免费在线 | 综合久久综合久久 | 精品av天堂毛片久久久借种 | 久久久久亚洲 | 欧美精品一区在线 | 一区二区高清 | 一本色道精品久久一区二区三区 | 精品在线播放 | 视频一区二区中文字幕 | 久久久久久av | 成人欧美一区二区三区1314 | 免费黄色片在线观看 | 日日草夜夜草 | 一区在线免费视频 | 日韩视频免费 | 亚洲自拍一区在线观看 | 国产精品久久久久久久久久妞妞 | av在线免费网 |