我使用小册子在地图上创建圆圈(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