我想用数据填充GeoJson图层,然后动态过滤要显示的功能.
我已经使过滤器功能工作,但我不知道如何更改过滤器,然后刷新图层.
添加数据后,有什么办法可以更新过滤器吗?
我需要使用最短距离在两点之间绘制一条折线。\n例如,我的位置是纽约,我在中国有一个位置,我想绘制一条连接这两个位置的折线。
\n\n我在哪里 - 请参阅此处的小提琴:http ://jsfiddle.net/Vsq4D/1/
\n\n问题是,当我画线时,它确实使用了最短距离。在上面的例子中,它从美国到中国,线向右,这是绕地球最长的距离,而不是向左,这是最短的距离。
\n\n我缺少什么?有什么想法如何根据最短距离画线吗?
\n\n
非常感谢任何帮助。
\n\nHTML:
\n\n<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.6.4/leaflet.css" />\n<!--[if lte IE 8]>\n <link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.6.4/leaflet.ie.css" />\n<![endif]-->\n\n<script src="http://cdn.leafletjs.com/leaflet-0.6.4/leaflet.js"></script>\n\n<div id="map" style="height:500px;"></div>\nRun Code Online (Sandbox Code Playgroud)\n\nJS:
\n\n//example user location\nvar userLocation = new L.LatLng(35.974, -83.496);\n\nvar map = L.map(\'map\').setView(userLocation, 1);\nL.tileLayer(\'http://{s}.tile.cloudmade.com/BC9A493B41014CAABB98F0471D759707/997/256/{z}/{x}/{y}.png\', {\nmaxZoom: 18,\nattribution: \'Map data © <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, Imagery \xc2\xa9 <a href="http://cloudmade.com">CloudMade</a>\'\n}).addTo(map);\n\n\nvar marker = new L.Marker(userLocation);\nmap.addLayer(marker);\n\n//random locations around the world\nvar items = [{\n //china\n lat: "65.337",\n lon: "158.027"\n}, {\n //colombia\n lat: "2.389",\n …Run Code Online (Sandbox Code Playgroud)