Fixed geojson example error #304

This commit is contained in:
mourner 2011-09-23 19:00:57 +03:00
parent c2e241e2bc
commit 0892da2aca

View File

@ -40,10 +40,10 @@
geojson.on('featureparse', function(e) { geojson.on('featureparse', function(e) {
// you can style features depending on their properties, etc. // you can style features depending on their properties, etc.
var popupText = 'geometry type: ' + e.geometryType + '<br/>'; var popupText = 'geometry type: ' + e.geometryType;
if (e.layer.setStyle) { if (e.layer.setStyle && e.properties && e.properties.color) {
e.layer.setStyle({color: e.properties.color}); e.layer.setStyle({color: e.properties.color});
popupText += 'color: ' + e.properties.color; popupText += '<br/>color: ' + e.properties.color;
} }
e.layer.bindPopup(popupText); e.layer.bindPopup(popupText);
}); });