我使用小冊子在地圖上創建圓圈(geojson)。圓形展示中心與小冊子
pointToLayer: function (feature, latlng){
if (feature.properties.radius) {
return new L.Circle(latlng, feature.properties.radius);
}
}
如何顯示這些圓的中心?
謝謝!
我使用小冊子在地圖上創建圓圈(geojson)。圓形展示中心與小冊子
pointToLayer: function (feature, latlng){
if (feature.properties.radius) {
return new L.Circle(latlng, feature.properties.radius);
}
}
如何顯示這些圓的中心?
謝謝!
您實際上可以在pointToLayer
Leaflet GeoJSON選項中返回Layer Group。
因此,你可以建立自己的圈子在你的代碼+標記(或任何你想要的,象徵你的心):
L.geoJSON(geoJsonData, {
pointToLayer: function (feature, latlng){
if (feature.properties.radius) {
//return new L.Circle(latlng, feature.properties.radius);
return L.layerGroup([
L.circle(latlng, feature.properties.radius),
L.marker(latlng) // or whatever symbol for circle center
]);
}
}
}).addTo(map);
演示:http://playground-leaflet.rhcloud.com/detaw/1/edit?html,output
你願意你的意思是什麼細說「顯示這些圈子的中心'? –
在這張照片 - > http://www.carto-sig.com/demo/circle.png我設法做了1,但我想要做的如圖2。 顯示圓的中心。 – Matthieu