Widget:LeafletWWW: Unterschied zwischen den Versionen
HorstR (Diskussion | Beiträge) Keine Bearbeitungszusammenfassung |
HorstR (Diskussion | Beiträge) Keine Bearbeitungszusammenfassung |
||
| Zeile 1: | Zeile 1: | ||
<div id="map" | <div id="map-frame"> | ||
<div id="map-title">Was War Wo</div> | |||
<div id="map"></div> | |||
<div id="map-footer"> | |||
<a href="https://hermsdoerfer.familyds.com/" target="_blank"> | |||
© Dietmar Hermsdörfer | |||
</a> | |||
</div> | |||
</div> | |||
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css"/> | <link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css"/> | ||
<link rel="stylesheet" href="https://unpkg.com/leaflet-control-geocoder/dist/Control.Geocoder.css"/> | |||
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"></script> | <script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"></script> | ||
<script src="https://unpkg.com/leaflet-control-geocoder/dist/Control.Geocoder.js"></script> | <script src="https://unpkg.com/leaflet-control-geocoder/dist/Control.Geocoder.js"></script> | ||
<style> | <style> | ||
#map { | |||
width:100%; | |||
height:88vh; | |||
border:3px solid black; | |||
border-radius:10px; | |||
} | |||
.layerbox { | |||
background:rgba(255,255,255,0.9); | background:rgba(255,255,255,0.9); | ||
padding:10px; | padding:10px; | ||
border-radius:6px; | border-radius:6px; | ||
box-shadow:0 0 10px rgba(0,0,0,0.3); | box-shadow:0 0 10px rgba(0,0,0,0.3); | ||
font-size:14px; | |||
max-height:70vh; | |||
overflow-y:auto; | |||
} | |||
.search-input { | |||
width:100%; | |||
margin-bottom:6px; | |||
padding:4px; | |||
border:1px solid #ccc; | |||
border-radius:4px; | |||
} | } | ||
#map-frame { | |||
position:relative; | |||
} | } | ||
#map-title { | |||
background:rgba(255,255,255,0. | position:absolute; | ||
padding: | top:10px; | ||
left:50%; | |||
transform:translateX(-50%); | |||
z-index:1000; | |||
background:rgba(255,255,255,0.85); | |||
padding:6px 14px; | |||
font-weight:bold; | |||
font-size:18px; | |||
border-radius:6px; | border-radius:6px; | ||
box-shadow:0 0 | box-shadow:0 0 6px rgba(0,0,0,0.3); | ||
} | } | ||
#map-footer { | |||
position:absolute; | |||
bottom:10px; | |||
left:10px; | |||
z-index:1000; | |||
background:rgba(255,255,255,0.85); | |||
padding:4px 10px; | |||
border-radius:6px; | |||
font-size:13px; | |||
box-shadow:0 0 6px rgba(0,0,0,0.3); | |||
} | } | ||
#map-footer a { | |||
color:red; | |||
text-decoration:none; | |||
font-weight:bold; | |||
} | } | ||
| Zeile 48: | Zeile 86: | ||
<script> | <script> | ||
var map = L.map('map',{ | |||
preferCanvas:true, | |||
tap: window.screen.width < 600, | |||
zoomSnap:0.5, | |||
zoomDelta:0.5 | |||
}).setView([50.95,6.95],12); | |||
var osm = L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png',{ | var osm = L.tileLayer( | ||
maxZoom:19, | 'https://tile.openstreetmap.org/{z}/{x}/{y}.png', | ||
attribution:'© OpenStreetMap' | {maxZoom:19, attribution:'© OpenStreetMap'} | ||
); | |||
var satellite = L.tileLayer( | var satellite = L.tileLayer( | ||
'https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', | 'https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', | ||
{ attribution:'Tiles © Esri' }); | {attribution:'Tiles © Esri'} | ||
); | |||
L.control.layers({ | osm.addTo(map); | ||
" | |||
L.control.layers( | |||
{ | |||
"Open Street Map":osm, | |||
"Satellit":satellite | "Satellit":satellite | ||
}).addTo(map); | } | ||
).addTo(map); | |||
L.Control.geocoder({ | L.Control.geocoder({ | ||
position:'topleft', | position:'topleft', | ||
placeholder: | defaultMarkGeocode:true, | ||
placeholder:"Suche ..." | |||
}).addTo(map); | }).addTo(map); | ||
var | var nutzungColors = { | ||
'Hof':'red', | |||
'Mühle':'blue', | |||
'Fabrik':'black', | |||
'Gewerbe':'gray', | |||
'Verwaltung':'orange', | |||
'Bahn':'brown', | |||
'Brücke':'navy', | |||
'Hafen':'blue', | |||
'Flughafen':'green', | |||
'Versorgung':'gray', | |||
'Tankstelle':'maroon', | |||
'Brauerei':'yellow', | |||
'Ziegelei':'red', | |||
'Kloster':'orange', | |||
'Kirche':'purple', | |||
'Synagoge':'violet', | |||
'Krankenhaus':'red', | |||
'Friedhof':'green', | |||
'Hochbunker':'black', | |||
'Militär':'green', | |||
'Wohnen':'brown', | |||
'Schule':'red', | |||
'Freizeit':'green' | |||
}; | |||
} | |||
var geojsonLayer = L.geoJSON(null,{ | |||
renderer: L.canvas(), | |||
style:function(feature){ | style:function(feature){ | ||
return{ | return{ | ||
color: | color:nutzungColors[feature.properties.Nutzung] || "black", | ||
weight:2, | weight:2, | ||
fillOpacity:0.4 | fillOpacity:0.4 | ||
}; | }; | ||
} | } | ||
}).addTo(map); | }).addTo(map); | ||
fetch('/alteskoeln/WWW.geojson') | |||
.then(res=>res.json()) | |||
.then(data=>{ | |||
geojsonLayer.addData(data); | |||
}); | }); | ||
</script> | </script> | ||
Version vom 14. März 2026, 13:55 Uhr
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css"/> <link rel="stylesheet" href="https://unpkg.com/leaflet-control-geocoder/dist/Control.Geocoder.css"/>
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"></script> <script src="https://unpkg.com/leaflet-control-geocoder/dist/Control.Geocoder.js"></script>
<style>
- map {
width:100%; height:88vh; border:3px solid black; border-radius:10px; }
.layerbox { background:rgba(255,255,255,0.9); padding:10px; border-radius:6px; box-shadow:0 0 10px rgba(0,0,0,0.3); font-size:14px; max-height:70vh; overflow-y:auto; }
.search-input { width:100%; margin-bottom:6px; padding:4px; border:1px solid #ccc; border-radius:4px; }
- map-frame {
position:relative; }
- map-title {
position:absolute; top:10px; left:50%; transform:translateX(-50%); z-index:1000; background:rgba(255,255,255,0.85); padding:6px 14px; font-weight:bold; font-size:18px; border-radius:6px; box-shadow:0 0 6px rgba(0,0,0,0.3); }
- map-footer {
position:absolute; bottom:10px; left:10px; z-index:1000; background:rgba(255,255,255,0.85); padding:4px 10px; border-radius:6px; font-size:13px; box-shadow:0 0 6px rgba(0,0,0,0.3); }
- map-footer a {
color:red; text-decoration:none; font-weight:bold; }
</style>
<script>
var map = L.map('map',{ preferCanvas:true, tap: window.screen.width < 600, zoomSnap:0.5, zoomDelta:0.5 }).setView([50.95,6.95],12);
var osm = L.tileLayer(
'https://tile.openstreetmap.org/{z}/{x}/{y}.png',
{maxZoom:19, attribution:'© OpenStreetMap'}
);
var satellite = L.tileLayer( 'https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {attribution:'Tiles © Esri'} );
osm.addTo(map);
L.control.layers( { "Open Street Map":osm, "Satellit":satellite } ).addTo(map);
L.Control.geocoder({
position:'topleft',
defaultMarkGeocode:true,
placeholder:"Suche ..."
}).addTo(map);
var nutzungColors = {
'Hof':'red',
'Mühle':'blue',
'Fabrik':'black',
'Gewerbe':'gray',
'Verwaltung':'orange',
'Bahn':'brown',
'Brücke':'navy',
'Hafen':'blue',
'Flughafen':'green',
'Versorgung':'gray',
'Tankstelle':'maroon',
'Brauerei':'yellow',
'Ziegelei':'red',
'Kloster':'orange',
'Kirche':'purple',
'Synagoge':'violet',
'Krankenhaus':'red',
'Friedhof':'green',
'Hochbunker':'black',
'Militär':'green',
'Wohnen':'brown',
'Schule':'red',
'Freizeit':'green'
};
var geojsonLayer = L.geoJSON(null,{
renderer: L.canvas(),
style:function(feature){
return{
color:nutzungColors[feature.properties.Nutzung] || "black",
weight:2,
fillOpacity:0.4
};
}
}).addTo(map);
fetch('/alteskoeln/WWW.geojson')
.then(res=>res.json())
.then(data=>{
geojsonLayer.addData(data);
});
</script>
