Permalink
Browse files

coords for different towns added

if calling map via <town>.maps.luftdaten.info, map will center on town,
if coords are known
added zoom per <town> and config.zoom
  • Loading branch information...
ricki-z committed Feb 7, 2017
1 parent 18877c9 commit 123ed72b803eef53290974b2d0788f31cd1e382a
Showing with 39 additions and 3 deletions.
  1. +2 −1 config.js.dist
  2. +35 −0 src/main.js
  3. +2 −2 src/map.vue
View
@@ -1,3 +1,4 @@
module.exports = {
center: [48.7791878,9.107176]
center: [48.80,9.20],
zoom: 11
}
View
@@ -13,7 +13,42 @@ console.log(query)
if (query.center) {
const center = query.center.split(',').map((coord) => parseFloat(coord))
config.center = center
} else {
var towns = new Array();
var zooms = new Array();
towns["stuttgart"] = [48.800000,9.200000];
towns["augsburg"] = [48.3585423,10.8943915];
towns["berlin"] = [52.516666666,13.383333333];
towns["bielefeld"] = [52.016666666,8.516666666];
towns['bremen'] = [53.076944444,8.808888888];
towns["dresden"] = [51.0517214,13.7310367];
towns["gera"] = [50.8758368,12.086176];
towns["greiz"] = [50.6535563,12.1884156];
towns["freiburg"] = [47.990000,7.820000];
towns["hamburg"] = [53.5464148,9.984099];
towns["jena"] = [50.9237905,11.5806506];
towns["konstanz"] = [47.660000,9.160000];
towns["muenchen"] = [48.140000,11.560000];
towns["muenster"] = [51.9502139,7.591131];
towns["oldenburg"] = [53.143888888,8.213888888];
towns["paderborn"] = [51.7231179,8.7548663];
towns["regensburg"] = [49.016666666,12.083333333];
towns["ulm"] = [48.3843119,10.000000];
towns["taiwan"] = [23.62985,121.05317]; zooms["taiwan"] = 9;
var hostname = location.hostname;
var hostname_parts = hostname.split(".");
var town = hostname_parts[0].toLowerCase();
if (typeof towns[town] !== 'undefined' && towns[town] !== null) {
config.center = towns[town];
}
if (typeof zooms[town] !== 'undefined' && zooms[town] !== null) {
config.zoom = zooms[town];
}
console.log("Center: "+config.center);
console.log("Zoom: "+config.zoom)
}
/* eslint-disable no-new */
new Vue(Main).$mount('#v-app')
View
@@ -13,11 +13,11 @@ export default {
this.$nextTick(() => {
let map = leaflet.map(this.$el, {
center: config.center,
zoom: 11
zoom: config.zoom
})
leaflet.tileLayer('https://{s}.tiles.madavi.de/{z}/{x}/{y}.png', {
attribution: 'Map data © <a href="https://openstreetmap.org">OpenStreetMap</a> contributors',
maxZoom: 13,
maxZoom: 14,
// continuousWorld: false,
// noWrap: true

0 comments on commit 123ed72

Please sign in to comment.