我目前正在使用 GeoJSON 并pointToLayer在我的地图上创建图标,我希望其中一些图标出现在顶部。
我的 GeoJSON 中有一个属性,在z_index我设置为 100 和其他 null 的一些值上调用它(通过研究,我认为我可以用这个来影响排序?)但到目前为止我尝试过的插件和东西不是工作(例如https://gist.github.com/up209d/4c68f2391f2302e510eb81aa8bcd4514 )
我当前的配置如下:
var geo_data = {{ geo_data|safe }}
{% for st in site_types %}
var z_index = null
var {{ st.safe_name }} = L.geoJSON(geo_data, {
filter: function(feature, layer) {
if (feature.geometry.coordinates != "None") {
return feature.properties.type === "{{ st.name }}";
}
},
pointToLayer: function (feature, latlng) {
return L.marker(latlng, {
icon: L.AwesomeMarkers.icon(
{
icon: feature.properties.icon,
markerColor: feature.properties.color,
prefix: 'fa',
iconColor: 'white',
}
)
}
);
},
onEachFeature: function (feature, layer) {
layer.bindPopup('<h3><a href="/sites/site/'+feature.properties.site_id+'">'+feature.properties.popupContent+'</a></h3>');
}
});
{% endfor %}
这是目前应该在顶部的图标示例,看起来它的 z-index 设置为 1901
<div class="awesome-marker-icon-darkred awesome-marker leaflet-zoom-animated leaflet-interactive" tabindex="0" style="margin-left: -17px; margin-top: -42px; width: 35px; height: 45px; transform: translate3d(512px, 901px, 0px); z-index: 1901; outline: none;"><i class="fa fa-server icon-white"></i></div>
德玛西亚99
相关分类