32 lines
751 B
JavaScript
Executable File
32 lines
751 B
JavaScript
Executable File
var formen = [{
|
|
"type": "Feature",
|
|
"properties": {
|
|
"farbe": "red",
|
|
"info": "BT 56"
|
|
},
|
|
"geometry": {
|
|
"type": "Polygon",
|
|
"coordinates": [[
|
|
[ 8.896696195006372, 53.054442380171004], //Reihenfolge umgekehrt: LonLat
|
|
[ 8.896603155881166, 53.05449229656882],
|
|
[ 8.896517828106882, 53.054433855886636],
|
|
[ 8.89661053195596 , 53.05438418124448]
|
|
]]
|
|
}
|
|
}
|
|
|
|
];
|
|
|
|
L.geoJson(formen,{
|
|
style: function(feature){
|
|
return {weight: 1, color: feature.properties.farbe};
|
|
},
|
|
onEachFeature: onEachFeature
|
|
}
|
|
).addTo(map);
|
|
|
|
function onEachFeature(feature, layer) {
|
|
if (feature.properties && feature.properties.info) {
|
|
layer.bindPopup(feature.properties.info);
|
|
}
|
|
} |