mirror of
https://github.com/CodeforLeipzig/stadtratmonitor.git
synced 2024-12-22 23:53:15 +01:00
add map with district councils
This commit is contained in:
parent
1612893b17
commit
f0e1f53993
4 changed files with 492 additions and 2 deletions
476
app/assets/javascripts/geo.js
Normal file
476
app/assets/javascripts/geo.js
Normal file
|
@ -0,0 +1,476 @@
|
||||||
|
function geojsonDaten() {
|
||||||
|
return {
|
||||||
|
"type": "FeatureCollection",
|
||||||
|
"features": [
|
||||||
|
{
|
||||||
|
"type": "Feature",
|
||||||
|
"properties": {
|
||||||
|
"name": "Stadtbezirksbeirat Mitte",
|
||||||
|
"raum": "Neues Rathaus, Zi. 495",
|
||||||
|
"ort": "Martin-Luther-Ring 4-6, 04109 Leipzig",
|
||||||
|
"typ": "Stadtbezirksbeirat",
|
||||||
|
"id": "2350"
|
||||||
|
},
|
||||||
|
"geometry": {
|
||||||
|
"type": "Point",
|
||||||
|
"coordinates": [
|
||||||
|
12.3726786,
|
||||||
|
51.3360228
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Feature",
|
||||||
|
"properties": {
|
||||||
|
"name": "Stadtbezirksbeirat Nordost",
|
||||||
|
"raum": "Rathaus Schönefeld, Raum 100",
|
||||||
|
"ort": "Ossietzkystraße 37, 04347 Leipzig",
|
||||||
|
"typ": "Stadtbezirksbeirat",
|
||||||
|
"id": "2284"
|
||||||
|
},
|
||||||
|
"geometry": {
|
||||||
|
"type": "Point",
|
||||||
|
"coordinates": [
|
||||||
|
12.4106166658912,
|
||||||
|
51.35950645
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Feature",
|
||||||
|
"properties": {
|
||||||
|
"name": "Stadtbezirksbeirat Ost",
|
||||||
|
"raum": "IC-E Informationszentrum",
|
||||||
|
"ort": "Eisenbahnstraße 49, 04315 Leipzig",
|
||||||
|
"typ": "Stadtbezirksbeirat",
|
||||||
|
"id": "2295"
|
||||||
|
},
|
||||||
|
"geometry": {
|
||||||
|
"type": "Point",
|
||||||
|
"coordinates": [
|
||||||
|
12.4022556,
|
||||||
|
51.3458445
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Feature",
|
||||||
|
"properties": {
|
||||||
|
"name": "Stadtbezirksbeirat Südost",
|
||||||
|
"raum": "Franz-Mehring-Schule",
|
||||||
|
"ort": "Gletschersteinstraße 9, 04299 Leipzig",
|
||||||
|
"typ": "Stadtbezirksbeirat",
|
||||||
|
"id": "2324"
|
||||||
|
},
|
||||||
|
"geometry": {
|
||||||
|
"type": "Point",
|
||||||
|
"coordinates": [
|
||||||
|
12.425064636414,
|
||||||
|
51.3165416
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Feature",
|
||||||
|
"properties": {
|
||||||
|
"name": "Stadtbezirksbeirat Süd",
|
||||||
|
"raum": "Immanuel-Kant-Gymnasium, Zi. 024",
|
||||||
|
"ort": "Scharnhorststraße 15, 04275 Leipzig",
|
||||||
|
"typ": "Stadtbezirksbeirat",
|
||||||
|
"id": "2369"
|
||||||
|
},
|
||||||
|
"geometry": {
|
||||||
|
"type": "Point",
|
||||||
|
"coordinates": [
|
||||||
|
12.3724315691414,
|
||||||
|
51.3199336
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Feature",
|
||||||
|
"properties": {
|
||||||
|
"name": "Stadtbezirksbeirat Südwest",
|
||||||
|
"raum": "Schule am Adler - Oberschule, Erdgeschoss - Raum 10",
|
||||||
|
"ort": "Antonienstraße 24, 04229 Leipzig",
|
||||||
|
"typ": "Stadtbezirksbeirat",
|
||||||
|
"id": "2309"
|
||||||
|
},
|
||||||
|
"geometry": {
|
||||||
|
"type": "Point",
|
||||||
|
"coordinates": [
|
||||||
|
12.3293545312521,
|
||||||
|
51.3209155
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Feature",
|
||||||
|
"properties": {
|
||||||
|
"name": "Stadtbezirksbeirat West",
|
||||||
|
"raum": "Freizeittreff \"Völkerfreundschaft\", Großer Saal",
|
||||||
|
"ort": "Stuttgarter Allee 9, 04209 Leipzig",
|
||||||
|
"typ": "Stadtbezirksbeirat",
|
||||||
|
"id": "2282"
|
||||||
|
},
|
||||||
|
"geometry": {
|
||||||
|
"type": "Point",
|
||||||
|
"coordinates": [
|
||||||
|
12.2915533009981,
|
||||||
|
51.3156583
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Feature",
|
||||||
|
"properties": {
|
||||||
|
"name": "Stadtbezirksbeirat Alt-West",
|
||||||
|
"raum": "Rathaus Leutzsch, Beratungsraum 1. Etage",
|
||||||
|
"ort": "Georg-Schwarz-Straße 140, 04179 Leipzig",
|
||||||
|
"typ": "Stadtbezirksbeirat",
|
||||||
|
"id": "2271"
|
||||||
|
},
|
||||||
|
"geometry": {
|
||||||
|
"type": "Point",
|
||||||
|
"coordinates": [
|
||||||
|
12.3138069902423,
|
||||||
|
51.34783805
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Feature",
|
||||||
|
"properties": {
|
||||||
|
"name": "Stadtbezirksbeirat Nordwest",
|
||||||
|
"raum": "Stadtteilzentrum \"ANKER\"",
|
||||||
|
"ort": "Renftstraße 1, 04159 Leipzig",
|
||||||
|
"typ": "Stadtbezirksbeirat",
|
||||||
|
"id": "2250"
|
||||||
|
},
|
||||||
|
"geometry": {
|
||||||
|
"type": "Point",
|
||||||
|
"coordinates": [
|
||||||
|
12.3430596,
|
||||||
|
51.3675295
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Feature",
|
||||||
|
"properties": {
|
||||||
|
"name": "Stadtbezirksbeirat Nord",
|
||||||
|
"raum": "Gohlis-Center, Zi. 340",
|
||||||
|
"ort": "Elsbethstraße 19-25, 04155 Leipzig",
|
||||||
|
"typ": "Stadtbezirksbeirat",
|
||||||
|
"id": "2272"
|
||||||
|
},
|
||||||
|
"geometry": {
|
||||||
|
"type": "Point",
|
||||||
|
"coordinates": [
|
||||||
|
12.3643525,
|
||||||
|
51.3634285
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Feature",
|
||||||
|
"properties": {
|
||||||
|
"name": "Ortschaftsrat Böhlitz-Ehrenberg",
|
||||||
|
"raum": "Große Eiche, Salon Böhlitz",
|
||||||
|
"ort": "Leipziger Straße 81, 04178 Leipzig",
|
||||||
|
"typ": "Ortschaftsrat",
|
||||||
|
"id": "2261"
|
||||||
|
},
|
||||||
|
"geometry": {
|
||||||
|
"type": "Point",
|
||||||
|
"coordinates": [
|
||||||
|
12.2907928,
|
||||||
|
51.3595433
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Feature",
|
||||||
|
"properties": {
|
||||||
|
"name": "Ortschaftsrat Burghausen",
|
||||||
|
"raum": "ehem. Gemeindeamt Burghausen, Sitzungszimmer",
|
||||||
|
"ort": "Miltitzer Straße 1, 04178 Leipzig",
|
||||||
|
"typ": "Ortschaftsrat",
|
||||||
|
"id": "2259"
|
||||||
|
},
|
||||||
|
"geometry": {
|
||||||
|
"type": "Point",
|
||||||
|
"coordinates": [
|
||||||
|
12.2649439543724,
|
||||||
|
51.35492225
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Feature",
|
||||||
|
"properties": {
|
||||||
|
"name": "Ortschaftsrat Engelsdorf",
|
||||||
|
"raum": "Versammlungsraum des Ortschaftsrates Engelsdorf",
|
||||||
|
"ort": "Engelsdorfer Str. 345, 04319 Leipzig",
|
||||||
|
"typ": "Ortschaftsrat",
|
||||||
|
"id": "2336"
|
||||||
|
},
|
||||||
|
"geometry": {
|
||||||
|
"type": "Point",
|
||||||
|
"coordinates": [
|
||||||
|
12.4901256,
|
||||||
|
51.3390546
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Feature",
|
||||||
|
"properties": {
|
||||||
|
"name": "Ortschaftsrat Hartmannsdorf-Knautnaundorf",
|
||||||
|
"raum": "Gaststätte \"Zur Ratte\"",
|
||||||
|
"ort": "Erikenstraße 10, 04249 Leipzig",
|
||||||
|
"typ": "Ortschaftsrat",
|
||||||
|
"id": "2283"
|
||||||
|
},
|
||||||
|
"geometry": {
|
||||||
|
"type": "Point",
|
||||||
|
"coordinates": [
|
||||||
|
12.3086769,
|
||||||
|
51.2653949
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Feature",
|
||||||
|
"properties": {
|
||||||
|
"name": "Ortschaftsrat Holzhausen",
|
||||||
|
"raum": "Schule Holzhausen, Aula",
|
||||||
|
"ort": "Stötteritzer Landstraße 21, 04288 Leipzig",
|
||||||
|
"typ": "Ortschaftsrat",
|
||||||
|
"id": "2262"
|
||||||
|
},
|
||||||
|
"geometry": {
|
||||||
|
"type": "Point",
|
||||||
|
"coordinates": [
|
||||||
|
12.4658203,
|
||||||
|
51.3049215
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Feature",
|
||||||
|
"properties": {
|
||||||
|
"name": "Ortschaftsrat Liebertwolkwitz",
|
||||||
|
"raum": "Rathaus Liebertwolkwitz, Zi. 2",
|
||||||
|
"ort": "Liebertwolkwitzer Markt 1, 04288 Leipzig",
|
||||||
|
"typ": "Ortschaftsrat",
|
||||||
|
"id": "2330"
|
||||||
|
},
|
||||||
|
"geometry": {
|
||||||
|
"type": "Point",
|
||||||
|
"coordinates": [
|
||||||
|
12.4642926352189,
|
||||||
|
51.28270915
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Feature",
|
||||||
|
"properties": {
|
||||||
|
"name": "Ortschaftsrat Lindenthal",
|
||||||
|
"raum": "Rathaus Lindenthal, Ratssaal",
|
||||||
|
"ort": "Erich-Thiele-Str. 2, 04159 Leipzig",
|
||||||
|
"typ": "Ortschaftsrat",
|
||||||
|
"id": "2316"
|
||||||
|
},
|
||||||
|
"geometry": {
|
||||||
|
"type": "Point",
|
||||||
|
"coordinates": [
|
||||||
|
12.327974438667297,
|
||||||
|
51.392381000768204
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Feature",
|
||||||
|
"properties": {
|
||||||
|
"name": "Ortschaftsrat Lützschena-Stahmeln",
|
||||||
|
"raum": "ehem. Feuerwehrgerätehaus Stahmeln",
|
||||||
|
"ort": "Mühlenstraße 21, 04159 Leipzig",
|
||||||
|
"typ": "Ortschaftsrat",
|
||||||
|
"id": "2368"
|
||||||
|
},
|
||||||
|
"geometry": {
|
||||||
|
"type": "Point",
|
||||||
|
"coordinates": [
|
||||||
|
12.3011131,
|
||||||
|
51.3766107
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Feature",
|
||||||
|
"properties": {
|
||||||
|
"name": "Ortschaftsrat Miltitz",
|
||||||
|
"raum": "Grundschule Miltitz, Speiseraum",
|
||||||
|
"ort": "Großmiltitzer Straße 4, 04205 Leipzig",
|
||||||
|
"typ": "Ortschaftsrat",
|
||||||
|
"id": "2365"
|
||||||
|
},
|
||||||
|
"geometry": {
|
||||||
|
"type": "Point",
|
||||||
|
"coordinates": [
|
||||||
|
12.2615069,
|
||||||
|
51.319427
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Feature",
|
||||||
|
"properties": {
|
||||||
|
"name": "Ortschaftsrat Mölkau",
|
||||||
|
"raum": "ehem. Gemeindeamt Mölkau, Ratssaal",
|
||||||
|
"ort": "Engelsdorfer Straße 90, 04316 Leipzig",
|
||||||
|
"typ": "Ortschaftsrat",
|
||||||
|
"id": "2255"
|
||||||
|
},
|
||||||
|
"geometry": {
|
||||||
|
"type": "Point",
|
||||||
|
"coordinates": [
|
||||||
|
12.441776,
|
||||||
|
51.3310749
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Feature",
|
||||||
|
"properties": {
|
||||||
|
"name": "Ortschaftsrat Plaußig ",
|
||||||
|
"raum": "Naturschutzstation Plaußig, Schulungsraum",
|
||||||
|
"ort": "Plaußiger Dorfstraße 23, 04349 Leipzig",
|
||||||
|
"typ": "Ortschaftsrat",
|
||||||
|
"id": "2377"
|
||||||
|
},
|
||||||
|
"geometry": {
|
||||||
|
"type": "Point",
|
||||||
|
"coordinates": [
|
||||||
|
12.4557221,
|
||||||
|
51.3922605
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Feature",
|
||||||
|
"properties": {
|
||||||
|
"name": "Ortschaftsrat Rückmarsdorf ",
|
||||||
|
"raum": "Ortsteilzentrum Rückmarsdorf",
|
||||||
|
"ort": "Ehrenberger Straße 5a, 04178 Leipzig",
|
||||||
|
"typ": "Ortschaftsrat",
|
||||||
|
"id": "2276"
|
||||||
|
},
|
||||||
|
"geometry": {
|
||||||
|
"type": "Point",
|
||||||
|
"coordinates": [
|
||||||
|
12.2784925298815,
|
||||||
|
51.34322465
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Feature",
|
||||||
|
"properties": {
|
||||||
|
"name": "Ortschaftsrat Seehausen",
|
||||||
|
"raum": "Gasthof Hohenheida",
|
||||||
|
"ort": "Am Anger 42, 04356 Leipzig",
|
||||||
|
"typ": "Ortschaftsrat",
|
||||||
|
"id": "2312"
|
||||||
|
},
|
||||||
|
"geometry": {
|
||||||
|
"type": "Point",
|
||||||
|
"coordinates": [
|
||||||
|
12.4455644647629,
|
||||||
|
51.4203442
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Feature",
|
||||||
|
"properties": {
|
||||||
|
"name": "Ortschaftsrat Wiederitzsch",
|
||||||
|
"raum": "Rathaus Wiederitzsch, Rathaussaal",
|
||||||
|
"ort": "Delitzscher Landstraße 55, 04158 Leipzig",
|
||||||
|
"typ": "Ortschaftsrat",
|
||||||
|
"id": "2304"
|
||||||
|
},
|
||||||
|
"geometry": {
|
||||||
|
"type": "Point",
|
||||||
|
"coordinates": [
|
||||||
|
12.3737383807901,
|
||||||
|
51.3935912
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var locked = null
|
||||||
|
var popUp;
|
||||||
|
|
||||||
|
var hoverToMarkerOffset = function (currentZoomLevel) {
|
||||||
|
return 0.39 / Math.pow(2, currentZoomLevel - 6);
|
||||||
|
};
|
||||||
|
|
||||||
|
var registerListeners = function (map, geojsonLayer) {
|
||||||
|
|
||||||
|
geojsonLayer.on('mouseover', function (event) {
|
||||||
|
var coords = event.layer.feature.geometry.coordinates;
|
||||||
|
if (map && (coords != locked)) {
|
||||||
|
hidePopUp(map);
|
||||||
|
showPopUp(map, event);
|
||||||
|
locked = coords;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
geojsonLayer.on('click', function (event) {
|
||||||
|
if (popUp && map) {
|
||||||
|
var coords = event.layer.feature.geometry.coordinates;
|
||||||
|
if (locked == coords) {
|
||||||
|
locked = null;
|
||||||
|
} else {
|
||||||
|
showPopUp(map, event);
|
||||||
|
locked = coords;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function showPopUp(map, event) {
|
||||||
|
var coords = event.layer.feature.geometry.coordinates;
|
||||||
|
var popUpCoords = [coords[1] + hoverToMarkerOffset(map.getZoom()), coords[0]];
|
||||||
|
var properties = event.layer.feature.properties
|
||||||
|
popUp = L.popup()
|
||||||
|
.setLatLng(popUpCoords)
|
||||||
|
.setContent(createPopUpContent(properties))
|
||||||
|
.openOn(map);
|
||||||
|
}
|
||||||
|
|
||||||
|
function hidePopUp(map) {
|
||||||
|
map.closePopup(popUp);
|
||||||
|
popUp = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function createPopUpContent(properties) {
|
||||||
|
var content = "<b>" + properties.name + "</b>";
|
||||||
|
content += "<br />";
|
||||||
|
content += "<span style=\"text-decoration: underline;\">Adresse:</span> "
|
||||||
|
content += properties.ort
|
||||||
|
content += "<br />"
|
||||||
|
content += "<span style=\"text-decoration: underline;\">Raum:</span> "
|
||||||
|
content += properties.raum
|
||||||
|
content += "<ul>"
|
||||||
|
content += "<li><a href=\"https://ratsinfo.leipzig.de/bi/au020.asp?AULFDNR=" + properties.id + "\">Mitglieder</a></li>"
|
||||||
|
content += "<li><a href=\"https://ratsinfo.leipzig.de/bi/si018_a.asp?GRA=" + properties.id + "\">Sitzungen</a></li>"
|
||||||
|
content += "</ul>"
|
||||||
|
return content
|
||||||
|
}
|
1
app/assets/stylesheets/objects/_geo.scss
Normal file
1
app/assets/stylesheets/objects/_geo.scss
Normal file
|
@ -0,0 +1 @@
|
||||||
|
#map {height: 700px}
|
|
@ -4,15 +4,17 @@ html
|
||||||
title Stadtratmonitor Leipzig - Karte
|
title Stadtratmonitor Leipzig - Karte
|
||||||
= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true
|
= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true
|
||||||
= stylesheet_link_tag 'https://unpkg.com/leaflet@1.0.1/dist/leaflet.css'
|
= stylesheet_link_tag 'https://unpkg.com/leaflet@1.0.1/dist/leaflet.css'
|
||||||
|
= javascript_include_tag 'geo'
|
||||||
= javascript_include_tag 'vendor/modernizr'
|
= javascript_include_tag 'vendor/modernizr'
|
||||||
= javascript_include_tag 'https://unpkg.com/leaflet@1.0.1/dist/leaflet.js'
|
= javascript_include_tag 'https://unpkg.com/leaflet@1.0.1/dist/leaflet.js'
|
||||||
|
= javascript_include_tag 'https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js'
|
||||||
= csrf_meta_tags
|
= csrf_meta_tags
|
||||||
|
|
||||||
body
|
body
|
||||||
.row
|
.row
|
||||||
.small-12.columns
|
.small-12.columns
|
||||||
.clearfix
|
.clearfix
|
||||||
h3#title = 'Karte'
|
h3#title = 'Stadtbezirksräte und Ortschaftsräte'
|
||||||
div#map/
|
div#map/
|
||||||
javascript:
|
javascript:
|
||||||
var map = L.map('map').setView([51.3399028, 12.3742236], 12);
|
var map = L.map('map').setView([51.3399028, 12.3742236], 12);
|
||||||
|
@ -23,3 +25,13 @@ html
|
||||||
minZoom: 12
|
minZoom: 12
|
||||||
}
|
}
|
||||||
).addTo(map);
|
).addTo(map);
|
||||||
|
$.ajaxSetup({
|
||||||
|
scriptCharset: "utf-8",
|
||||||
|
contentType: "application/json; charset=utf-8"
|
||||||
|
});
|
||||||
|
|
||||||
|
var geojsonLayer = L.geoJson(geojsonDaten());
|
||||||
|
map.addLayer(geojsonLayer);
|
||||||
|
|
||||||
|
registerListeners(map, geojsonLayer)
|
||||||
|
|
||||||
|
|
|
@ -6,3 +6,4 @@ Rails.application.config.assets.version = '1.0'
|
||||||
# Precompile additional assets.
|
# Precompile additional assets.
|
||||||
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
|
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
|
||||||
# Rails.application.config.assets.precompile += %w( search.js )
|
# Rails.application.config.assets.precompile += %w( search.js )
|
||||||
|
Rails.application.config.assets.precompile += %w( geo.js )
|
Loading…
Reference in a new issue