Leaflet 传单:如何在GeoJSON层上添加属性?
我需要在传单地图上使用GeoJSON图层。以下是我的代码示例:Leaflet 传单:如何在GeoJSON层上添加属性?,leaflet,geojson,Leaflet,Geojson,我需要在传单地图上使用GeoJSON图层。以下是我的代码示例: function onEachFeature(feature, layer) { if (feature.properties && feature.properties.popupContent) { layer.bindPopup(feature.properties.popupContent); } } myGeoJsonLayer = L.geoJson(data, {
function onEachFeature(feature, layer) {
if (feature.properties && feature.properties.popupContent) {
layer.bindPopup(feature.properties.popupContent);
}
}
myGeoJsonLayer = L.geoJson(data, {
pointToLayer: function (feature, latlng) {
return L.circleMarker(latlng, geojsonMarkerOptions);
},
onEachFeature: onEachFeature
});
myGeoJsonLayer.addTo(map);
TOC.addOverlay(myGeoJsonLayer, "My GeoJSON Layer");
一切正常
现在我想在我的图层上添加属性,但如何添加
非常感谢您的建议。默认情况下,这不受支持,但您可以在这样的实例上添加GetAttribute方法:默认情况下,这不受支持,但您可以在这样的实例上添加GetAttribute方法:您认为层上的属性是什么意思?请举个例子。嗨,马克!我是说这个。例如,属性是您在地图右下角附近看到的。如果你看到地图下面的代码,你会看到。。。。属性:'&复制;osm.org/copyright>OpenStreetMap contributors'我很清楚如何为基于tiles Tillelayer的图层添加属性,但我不知道如何使用GeoJson图层。谢谢你对图层上的属性是什么意思?请举个例子。嗨,马克!我是说这个。例如,属性是您在地图右下角附近看到的。如果你看到地图下面的代码,你会看到。。。。属性:'&复制;osm.org/copyright>OpenStreetMap contributors'我很清楚如何为基于tiles Tillelayer的图层添加属性,但我不知道如何使用GeoJson图层。谢谢