我是一种新的geojson属性和传单js代码。
这是一个非常简单的问题,但是当我在我的标记中创建bindpopup时,geojson变量的标题会消失,因此我只看到html标记内容但没有标题。
我希望在弹出标题和标题下看到弹出内容。
但正如我所说,标题消失了。这是你的时间的代码和thx:)
geojson = [{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [data[i].longitude,data[i].latitude]
},
"properties": {
"title": "Emergencia: "+data[i].priority,
"icon": {
"iconUrl": data[i].imagen,
"iconSize": [50, 50], // size of the icon
"iconAnchor": [25, 50], // point of the icon which will correspond to marker's location
"popupAnchor": [0, -25], // point from which the popup should open relative to the iconAnchor
"className": "dot"
}
}
}]; //alert(data[i].longitude.valueOf());
var myLayer = L.mapbox.featureLayer().setGeoJSON(geojson).addTo(map);
myLayer.on('layeradd', function(e) {
var marker = e.layer,
feature = marker.feature;
marker.setIcon(L.icon(feature.properties.icon));
var popupContent='<br><p>Id emergencia:'+data[i].id_emergency+'</p>'//IMPORTANTISIMO
marker.bindPopup(popupContent,{
closeButton: true,
minWidth: 150
});
});
myLayer.setGeoJSON(geojson);