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

  1. <small id='cyw1U'></small><noframes id='cyw1U'>

      • <bdo id='cyw1U'></bdo><ul id='cyw1U'></ul>
      <tfoot id='cyw1U'></tfoot>

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

    1. <legend id='cyw1U'><style id='cyw1U'><dir id='cyw1U'><q id='cyw1U'></q></dir></style></legend>

      傳單:如何交換從 ajax 調(diào)用接收到的坐標(biāo)

      Leaflet: how to swap coordinates received from an ajax call(傳單:如何交換從 ajax 調(diào)用接收到的坐標(biāo))

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

          <tfoot id='PZo4L'></tfoot>
          • <bdo id='PZo4L'></bdo><ul id='PZo4L'></ul>
                <tbody id='PZo4L'></tbody>

            • <legend id='PZo4L'><style id='PZo4L'><dir id='PZo4L'><q id='PZo4L'></q></dir></style></legend>

                <i id='PZo4L'><tr id='PZo4L'><dt id='PZo4L'><q id='PZo4L'><span id='PZo4L'><b id='PZo4L'><form id='PZo4L'><ins id='PZo4L'></ins><ul id='PZo4L'></ul><sub id='PZo4L'></sub></form><legend id='PZo4L'></legend><bdo id='PZo4L'><pre id='PZo4L'><center id='PZo4L'></center></pre></bdo></b><th id='PZo4L'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='PZo4L'><tfoot id='PZo4L'></tfoot><dl id='PZo4L'><fieldset id='PZo4L'></fieldset></dl></div>
                本文介紹了傳單:如何交換從 ajax 調(diào)用接收到的坐標(biāo)的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                問題描述

                我正在使用 Leaflet 1.0.3 和一些插件,包括 Leaflet.ajax.我的 L.geo.ajax 調(diào)用正在工作并返回 geojson 對象,但是坐標(biāo)是相反的.我創(chuàng)建了一個函數(shù)來解決這個問題:

                I am using Leaflet 1.0.3 and a few plugins including Leaflet.ajax. My L.geo.ajax call is working and returning geojson objects, however, the coordinates are reversed. I created a function to fix this:

                    var convertLatLng = function (latlng) {
                    var temp = latlng[y];
                    latlng[y] = latlng[x];
                    latlng[x] = temp;
                    convertedLatLng = latlng;
                    return convertedLatLng;
                    console.log('this function is running')
                    }

                但我的問題是我不知道該放在哪里.我是否在我的 geoJson 調(diào)用中運行它?如果有,在哪里?這是 ajax 調(diào)用的片段:

                But my problem is I don't know where to put it. Do I run it inside my geoJson call? If so, where? Here is a snippet of the ajax call:

                    var geojson = L.geoJson.ajax('http://www.iotwf.com/deployment_map/json', {
                
                    pointToLayer: function (feature, latlng) {
                    convertLatLng(latlng);
                    ...
                    },
                    onEachFeature: function(feature, layer) {
                 
                    ...
                    }
                    });

                我也愿意接受其他可以解決問題的建議.

                I am also open to other suggestions for what may fix it.

                推薦答案

                歡迎來到 SO!

                首先確保你的坐標(biāo)確實是顛倒的.

                First make sure that your coordinates are indeed reversed.

                請注意,GeoJSON 格式需要 [longitude, latitude],而 Leaflet 通常需要 [latitude, longitude],除了 L.geoJSON() 工廠(和插件 L.geoJson.ajax()),它會自動讀取 GeoJSON 順序并在正確的坐標(biāo)處構(gòu)建圖層.

                Note that the GeoJSON format expects [longitude, latitude], whereas Leaflet usually expects [latitude, longitude], EXCEPT in the case of L.geoJSON() factory (and the plugin L.geoJson.ajax()), where it automatically reads the GeoJSON order and builds the layers at the correct coordinates.

                如果您的坐標(biāo)仍然是反向的,那么適當(dāng)?shù)母@然是直接更正數(shù)據(jù)源中的順序(或任何服務(wù)輸出您的數(shù)據(jù)),以便您獲得實際兼容的 GeoJSON 數(shù)據(jù).這將解決許多未來的難題.

                If your coordinates are still reversed, the appropriate correction would be obviously to correct the order in your data source directly (or whatever service outputs your data), so that you get actually compliant GeoJSON data. That would solve many future headaches.

                如果這不可能,那么您確實可以在腳本中嘗試解決方法.

                If that is not possible, then indeed you could try a workaround within your script.

                最合適的方法可能是使用 L.geoJSON 工廠的>coordsToLatLng 選項.

                The most appropriate way to do so would probably be to use the coordsToLatLng option of the L.geoJSON factory.

                更改其 默認(rèn)實現(xiàn),你會得到類似的東西:

                Changing its default implementation, you would get something like:

                L.geoJson.ajax(url, {
                    coordsToLatLng: function (coords) {
                        //                    latitude , longitude, altitude
                        //return new L.LatLng(coords[1], coords[0], coords[2]); //Normal behavior
                        return new L.LatLng(coords[0], coords[1], coords[2]);
                    }
                });
                

                這篇關(guān)于傳單:如何交換從 ajax 調(diào)用接收到的坐標(biāo)的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

                相關(guān)文檔推薦

                Check if a polygon point is inside another in leaflet(檢查一個多邊形點是否在傳單中的另一個內(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ā)點擊傳單標(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è)邊欄)
                  <tfoot id='PZKWK'></tfoot>

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

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

                            <tbody id='PZKWK'></tbody>
                          主站蜘蛛池模板: 黄色片视频网站 | 国产成人在线免费 | 欧美日批| 精品欧美一区免费观看α√ | 天天色综 | 日日骚av | 日韩在线免费视频 | 一区二区三区国产 | 久在线视频播放免费视频 | 精品视频一区二区三区在线观看 | 欧美日韩在线视频一区 | 三级成人在线 | 午夜一级大片 | 成人在线一区二区 | 欧美精品片 | 五月婷婷在线视频 | 亚洲国产精品99久久久久久久久 | 久久99精品久久久水蜜桃 | 狠狠的操 | 伊人网一区 | 久久99精品久久久久久狂牛 | 婷婷综合五月天 | 天天操天天插 | 在线免费观看日本 | 天堂成人国产精品一区 | 亚洲精品在线视频 | 男女视频在线观看网站 | 国产精品一卡 | 伊人天堂网 | 欧美日韩免费视频 | 亚洲免费网站 | 日韩美女在线看免费观看 | 成人欧美一区二区 | 国产一区二区a | 伊人天堂网 | 免费观看的黄色网址 | 精品91视频| 日本小电影网站 | 久久国产精品色av免费观看 | 国产激情99| 精品美女视频在线观看免费软件 |