parent
ae971ed873
commit
f9c4ce1bd8
@ -1,22 +1,13 @@
|
||||
"""
|
||||
URL configuration for chartacapsa project.
|
||||
|
||||
The `urlpatterns` list routes URLs to views. For more information please see:
|
||||
https://docs.djangoproject.com/en/6.0/topics/http/urls/
|
||||
Examples:
|
||||
Function views
|
||||
1. Add an import: from my_app import views
|
||||
2. Add a URL to urlpatterns: path('', views.home, name='home')
|
||||
Class-based views
|
||||
1. Add an import: from other_app.views import Home
|
||||
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
|
||||
Including another URLconf
|
||||
1. Import the include() function: from django.urls import include, path
|
||||
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
|
||||
"""
|
||||
from django.contrib import admin
|
||||
from django.urls import path
|
||||
from django.urls import path, include
|
||||
from django.conf import settings
|
||||
from django.conf.urls.static import static
|
||||
|
||||
urlpatterns = [
|
||||
path('admin/', admin.site.urls),
|
||||
path('', include('gebiete.urls')), # Dashboard auf der Startseite
|
||||
]
|
||||
|
||||
# Wichtig für statische Dateien und GeoJSON im Debug-Modus
|
||||
if settings.DEBUG:
|
||||
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
|
||||
|
||||
@ -0,0 +1,273 @@
|
||||
{
|
||||
"type": "FeatureCollection",
|
||||
"features": [
|
||||
{
|
||||
"type": "Feature",
|
||||
"geometry": {
|
||||
"coordinates": [
|
||||
[
|
||||
[
|
||||
8.786209,
|
||||
50.794333
|
||||
],
|
||||
[
|
||||
8.787689,
|
||||
50.795065
|
||||
],
|
||||
[
|
||||
8.787196,
|
||||
50.795323
|
||||
],
|
||||
[
|
||||
8.786616,
|
||||
50.795262
|
||||
],
|
||||
[
|
||||
8.78594,
|
||||
50.795085
|
||||
],
|
||||
[
|
||||
8.784803,
|
||||
50.794841
|
||||
],
|
||||
[
|
||||
8.783945,
|
||||
50.794733
|
||||
],
|
||||
[
|
||||
8.783548,
|
||||
50.794638
|
||||
],
|
||||
[
|
||||
8.783162,
|
||||
50.794489
|
||||
],
|
||||
[
|
||||
8.782936,
|
||||
50.794251
|
||||
],
|
||||
[
|
||||
8.782657,
|
||||
50.793593
|
||||
],
|
||||
[
|
||||
8.782572,
|
||||
50.793275
|
||||
],
|
||||
[
|
||||
8.783237,
|
||||
50.793193
|
||||
],
|
||||
[
|
||||
8.783741,
|
||||
50.793247
|
||||
],
|
||||
[
|
||||
8.783934,
|
||||
50.793153
|
||||
],
|
||||
[
|
||||
8.784106,
|
||||
50.793064
|
||||
],
|
||||
[
|
||||
8.784471,
|
||||
50.793119
|
||||
],
|
||||
[
|
||||
8.784932,
|
||||
50.793288
|
||||
],
|
||||
[
|
||||
8.785307,
|
||||
50.793498
|
||||
],
|
||||
[
|
||||
8.785876,
|
||||
50.794055
|
||||
],
|
||||
[
|
||||
8.786209,
|
||||
50.794333
|
||||
]
|
||||
]
|
||||
],
|
||||
"type": "Polygon"
|
||||
},
|
||||
"properties": {
|
||||
"name": "Richtsberg 2",
|
||||
"id": 2
|
||||
},
|
||||
"id": "66bk4"
|
||||
},
|
||||
{
|
||||
"type": "Feature",
|
||||
"geometry": {
|
||||
"coordinates": [
|
||||
[
|
||||
[
|
||||
8.785018,
|
||||
50.793295
|
||||
],
|
||||
[
|
||||
8.78549,
|
||||
50.793634
|
||||
],
|
||||
[
|
||||
8.787496,
|
||||
50.793119
|
||||
],
|
||||
[
|
||||
8.786756,
|
||||
50.79303
|
||||
],
|
||||
[
|
||||
8.786584,
|
||||
50.79244
|
||||
],
|
||||
[
|
||||
8.787045,
|
||||
50.791837
|
||||
],
|
||||
[
|
||||
8.786756,
|
||||
50.791498
|
||||
],
|
||||
[
|
||||
8.783698,
|
||||
50.789653
|
||||
],
|
||||
[
|
||||
8.783001,
|
||||
50.790196
|
||||
],
|
||||
[
|
||||
8.783913,
|
||||
50.79067
|
||||
],
|
||||
[
|
||||
8.784438,
|
||||
50.791335
|
||||
],
|
||||
[
|
||||
8.783247,
|
||||
50.790528
|
||||
],
|
||||
[
|
||||
8.78284,
|
||||
50.790575
|
||||
],
|
||||
[
|
||||
8.781831,
|
||||
50.79044
|
||||
],
|
||||
[
|
||||
8.780737,
|
||||
50.790813
|
||||
],
|
||||
[
|
||||
8.780318,
|
||||
50.792508
|
||||
],
|
||||
[
|
||||
8.782593,
|
||||
50.793241
|
||||
],
|
||||
[
|
||||
8.783709,
|
||||
50.793227
|
||||
],
|
||||
[
|
||||
8.784385,
|
||||
50.793051
|
||||
],
|
||||
[
|
||||
8.78476,
|
||||
50.793207
|
||||
],
|
||||
[
|
||||
8.784889,
|
||||
50.793241
|
||||
],
|
||||
[
|
||||
8.785018,
|
||||
50.793295
|
||||
]
|
||||
]
|
||||
],
|
||||
"type": "Polygon"
|
||||
},
|
||||
"properties": {
|
||||
"name": "Richtsberg 3"
|
||||
},
|
||||
"id": "ZdDc0"
|
||||
},
|
||||
{
|
||||
"type": "Feature",
|
||||
"geometry": {
|
||||
"coordinates": [
|
||||
[
|
||||
[
|
||||
8.789207,
|
||||
50.795072
|
||||
],
|
||||
[
|
||||
8.788832,
|
||||
50.795329
|
||||
],
|
||||
[
|
||||
8.787362,
|
||||
50.794895
|
||||
],
|
||||
[
|
||||
8.786193,
|
||||
50.794326
|
||||
],
|
||||
[
|
||||
8.785495,
|
||||
50.793695
|
||||
],
|
||||
[
|
||||
8.786654,
|
||||
50.793275
|
||||
],
|
||||
[
|
||||
8.787566,
|
||||
50.793152
|
||||
],
|
||||
[
|
||||
8.788617,
|
||||
50.793593
|
||||
],
|
||||
[
|
||||
8.789282,
|
||||
50.794109
|
||||
],
|
||||
[
|
||||
8.789358,
|
||||
50.7944
|
||||
],
|
||||
[
|
||||
8.789883,
|
||||
50.794692
|
||||
],
|
||||
[
|
||||
8.789926,
|
||||
50.794902
|
||||
],
|
||||
[
|
||||
8.789207,
|
||||
50.795072
|
||||
]
|
||||
]
|
||||
],
|
||||
"type": "Polygon"
|
||||
},
|
||||
"properties": {
|
||||
"name": "Richtsberg-1",
|
||||
"id": 3
|
||||
},
|
||||
"id": "kLn2l"
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -0,0 +1 @@
|
||||
./beta_gebiet.geojson
|
||||
@ -0,0 +1,63 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>🗃️ KartenKiste - Dashboard</title>
|
||||
<!-- Leaflet CSS & JS einbinden -->
|
||||
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css" />
|
||||
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"></script>
|
||||
|
||||
|
||||
<style>
|
||||
body { font-family: sans-serif; background: #F4F7F6; margin: 0; padding: 20px; }
|
||||
#map { height: 500px; width: 100%; border-radius: 12px; box-shadow: 0 4px 12px rgba(0,0,0,0.05); }
|
||||
.container { max-width: 1200px; margin: 0 auto; }
|
||||
h1 { color: #2C3E50; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<h1>🗺️ Gebietsübersicht</h1>
|
||||
<!-- Hier wird die Karte gerendert -->
|
||||
<div id="map"></div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
// 1. Karte initialisieren und auf Deutschland/Ihre Region zentrieren
|
||||
// (Koordinaten [Breitengrad, Längengrad], Zoomstufe)
|
||||
const map = L.map('map').setView([51.1657, 10.4515], 6);
|
||||
|
||||
// 2. OpenStreetMap Kacheln hinzufügen (Clean & Modern Layout)
|
||||
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
||||
maxZoom: 19,
|
||||
}).addTo(map);
|
||||
|
||||
// 3. GeoJSON-Daten aus dem Django Static-Ordner laden
|
||||
fetch('/static/data/card.geojson')
|
||||
.then(response => response.json())
|
||||
.then(geoJsonData => {
|
||||
// GeoJSON zur Karte hinzufügen mit Styling
|
||||
const geoJsonLayer = L.geoJSON(geoJsonData, {
|
||||
style: function(feature) {
|
||||
return {
|
||||
color: '#A8C3B6', /* Unser Salbeigrün als Grenze */
|
||||
weight: 2,
|
||||
fillColor: '#D0E7DE', /* Unser Soft-Mint als Fläche */
|
||||
fillOpacity: 0.5
|
||||
};
|
||||
},
|
||||
onEachFeature: function(feature, layer) {
|
||||
// Popup-Inhalt beim Klick auf ein Gebiet
|
||||
// Ersetzt 'name' mit dem Feldnamen aus Ihrer uMap-Eigenschaft
|
||||
const gebietName = feature.properties.name || "Unbekanntes Gebiet";
|
||||
layer.bindPopup(`<strong>Gebiet:</strong> ${gebietName}`);
|
||||
}
|
||||
}).addTo(map);
|
||||
|
||||
// Karte automatisch so zoomen, dass alle Gebiete sichtbar sind
|
||||
map.fitBounds(geoJsonLayer.getBounds());
|
||||
})
|
||||
.catch(error => console.error('Fehler beim Laden der GeoJSON:', error));
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@ -0,0 +1,8 @@
|
||||
from django.urls import path
|
||||
from . import views
|
||||
|
||||
app_name = 'gebiete'
|
||||
|
||||
urlpatterns = [
|
||||
path('', views.dashboard, name='dashboard'),
|
||||
]
|
||||
@ -1,3 +1,7 @@
|
||||
from django.shortcuts import render
|
||||
|
||||
# Create your views here.
|
||||
from django.shortcuts import render
|
||||
|
||||
def dashboard(request):
|
||||
return render(request, 'gebiete/dashboard.html')
|
||||
|
||||
Loading…
Reference in new issue