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

  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="fwjpwtg" 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 調用接收到的坐標

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

      <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="vcf8nlj" id='PZo4L'><tfoot id='PZo4L'></tfoot><dl id='PZo4L'><fieldset id='PZo4L'></fieldset></dl></div>
                本文介紹了傳單:如何交換從 ajax 調用接收到的坐標的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                問題描述

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

                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 調用中運行它?如果有,在哪里?這是 ajax 調用的片段:

                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!

                首先確保你的坐標確實是顛倒的.

                First make sure that your coordinates are indeed reversed.

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

                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.

                如果您的坐標仍然是反向的,那么適當的更正顯然是直接更正數據源中的順序(或任何服務輸出您的數據),以便您獲得實際兼容的 GeoJSON 數據.這將解決許多未來的難題.

                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.

                更改其 默認實現,你會得到類似的東西:

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

                這篇關于傳單:如何交換從 ajax 調用接收到的坐標的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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 圖層控件添加到側邊欄)
                  <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="numsrsq" 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>
                          主站蜘蛛池模板: 无菌检查集菌仪,微生物限度仪器-苏州长留仪器百科 | 厂房出租-厂房规划-食品技术-厂房设计-厂房装修-建筑施工-设备供应-设备求购-龙爪豆食品行业平台 | 2025世界机器人大会_IC China_半导体展_集成电路博览会_智能制造展览网 | 卷筒电缆-拖链电缆-特种柔性扁平电缆定制厂家「上海缆胜」 | 微型气泵-真空-蠕动-水泵-厂家-深圳市品亚科技有限公司 | 洁净棚-洁净工作棚-无菌室-净化工程公司_北京卫护科技有限公司 | 上海道勤塑化有限公司| 鼓风干燥箱_真空烘箱_高温干燥箱_恒温培养箱-上海笃特科学仪器 | Trimos测长机_测高仪_TESA_mahr,WYLER水平仪,PWB对刀仪-德瑞华测量技术(苏州)有限公司 | 定制异形重型钢格栅板/钢格板_定做踏步板/排水沟盖板_钢格栅板批发厂家-河北圣墨金属制品有限公司 | 诺冠气动元件,诺冠电磁阀,海隆防爆阀,norgren气缸-山东锦隆自动化科技有限公司 | 密集柜_档案密集柜_智能密集架_密集柜厂家_密集架价格-智英伟业 密集架-密集柜厂家-智能档案密集架-自动选层柜订做-河北风顺金属制品有限公司 | 安徽净化工程设计_无尘净化车间工程_合肥净化实验室_安徽创世环境科技有限公司 | 青海电动密集架_智能密集架_密集架价格-盛隆柜业青海档案密集架厂家 | 山东齐鲁漆业有限公司【官网】-工业漆专业生产厂家 | 昆明网络公司|云南网络公司|昆明网站建设公司|昆明网页设计|云南网站制作|新媒体运营公司|APP开发|小程序研发|尽在昆明奥远科技有限公司 | 河南中整光饰机械有限公司-抛光机,去毛刺抛光机,精密镜面抛光机,全自动抛光机械设备 | 新密高铝耐火砖,轻质保温砖价格,浇注料厂家直销-郑州荣盛窑炉耐火材料有限公司 | 【铜排折弯机,钢丝折弯成型机,汽车发泡钢丝折弯机,线材折弯机厂家,线材成型机,铁线折弯机】贝朗折弯机厂家_东莞市贝朗自动化设备有限公司 | 企典软件一站式企业管理平台,可私有、本地化部署!在线CRM客户关系管理系统|移动办公OA管理系统|HR人事管理系统|人力 | 周口市风机厂,周鼓风机,河南省周口市风机厂 | 熔体泵_熔体出料泵_高温熔体泵-郑州海科熔体泵有限公司 | SRRC认证|CCC认证|CTA申请_IMEI|MAC地址注册-英利检测 | 压缩空气冷冻式干燥机_吸附式干燥机_吸干机_沪盛冷干机 | SDI车窗夹力测试仪-KEMKRAFT方向盘测试仪-上海爱泽工业设备有限公司 | 并离网逆变器_高频UPS电源定制_户用储能光伏逆变器厂家-深圳市索克新能源 | 篮球架_乒乓球台_足球门_校园_竞技体育器材_厂家_价格-沧州浩然体育器材有限公司 | 工业CT-无锡璟能智能仪器有限公司 | 防水接头-电缆防水接头-金属-电缆密封接头-不锈钢电缆接头 | 热缩管切管机-超声波切带机-织带切带机-无纺布切布机-深圳市宸兴业科技有限公司 | 蜘蛛车-高空作业平台-升降机-高空作业车租赁-臂式伸缩臂叉装车-登高车出租厂家 - 普雷斯特机械设备(北京)有限公司 | 润东方环保空调,冷风机,厂房车间降温设备-20年深圳环保空调生产厂家 | 一航网络-软件测评官网| 无轨电动平车_轨道平车_蓄电池电动平车★尽在新乡百特智能转运设备有限公司 | 绿萝净除甲醛|深圳除甲醛公司|测甲醛怎么收费|培训机构|电影院|办公室|车内|室内除甲醛案例|原理|方法|价格立马咨询 | 不锈钢搅拌罐_高速搅拌罐厂家-无锡市凡格德化工装备科技有限公司 | 温州食堂承包 - 温州市尚膳餐饮管理有限公司 | AGV叉车|无人叉车|AGV智能叉车|AGV搬运车-江西丹巴赫机器人股份有限公司 | 水厂污泥地磅|污泥处理地磅厂家|地磅无人值守称重系统升级改造|地磅自动称重系统维修-河南成辉电子科技有限公司 | 根系分析仪,大米外观品质检测仪,考种仪,藻类鉴定计数仪,叶面积仪,菌落计数仪,抑菌圈测量仪,抗生素效价测定仪,植物表型仪,冠层分析仪-杭州万深检测仪器网 | 背压阀|减压器|不锈钢减压器|减压阀|卫生级背压阀|单向阀|背压阀厂家-上海沃原自控阀门有限公司 本安接线盒-本安电路用接线盒-本安分线盒-矿用电话接线盒-JHH生产厂家-宁波龙亿电子科技有限公司 |