summaryrefslogtreecommitdiff
path: root/web
diff options
context:
space:
mode:
authorolf <olf@subsignal.org>2016-01-21 22:24:06 +0100
committerolf <olf@subsignal.org>2016-01-21 22:24:06 +0100
commitebe5e141a4fd0094e546bd869b45ee538c8b51f0 (patch)
treea3fa7fd19d6c61140e10523370b66fd69ae169d1 /web
parentfcf1e574081a01429ef116178b51ad598fe8acab (diff)
Revert "Add licence and use osm map"
This reverts commit fcf1e574081a01429ef116178b51ad598fe8acab.
Diffstat (limited to 'web')
-rw-r--r--web/js/eventmap.js134
-rw-r--r--web/js/layers.json10
2 files changed, 58 insertions, 86 deletions
diff --git a/web/js/eventmap.js b/web/js/eventmap.js
index c222005..7302da9 100644
--- a/web/js/eventmap.js
+++ b/web/js/eventmap.js
@@ -335,83 +335,65 @@ $(function() {
});
$("#progress").html("Retrieving layer info...");
- $.ajax({
- url: "js/layers.json",
- success: function(data) {
- $("#progress").html("Creating layers...");
- var first_layer = true;
- $.each(data, function(layer_index, layer_info) {
- var layer_path;
- var layer_options;
- var base_layer;
- var drawing_layer;
- var layer;
-
- if (layer_info.url === undefined) {
- layer_path = 'images/tiles/' + layer_info.name
- + '/{z}/{x}/{y}.png';
- } else {
- layer_path = layer_info.url;
- }
-
- if (layer_info.options === undefined) {
- layer_options = {
- noWrap: true,
- continuousWorld: true,
- maxZoom: layer_info.max_zoom
- };
- } else {
- layer_options = layer_info.options;
- }
-
- base_layer = L.tileLayer(layer_path, layer_options);
-
- drawing_layer = new L.FeatureGroup();
-
- layer = L.layerGroup([base_layer, drawing_layer]);
- layers[layer_info.name] = layer;
-
- if (first_layer) {
- map.addLayer(layer);
- first_layer = false;
- }
+ $.getJSON('js/layers.json', function(data) {
+ $("#progress").html("Creating layers...");
+ var first_layer = true;
+ $.each(data, function(layer_index, layer_info) {
+ var layer_path;
+ var base_layer;
+ var drawing_layer;
+ var layer;
+
+ layer_path = 'images/tiles/' + layer_info.name
+ + '/{z}/{x}/{y}.png';
+
+ base_layer = L.tileLayer(layer_path, {
+ noWrap: true,
+ continuousWorld: true,
+ maxZoom: layer_info.max_zoom
});
- var layer_control = L.control.layers(layers, {});
- map.on('baselayerchange', function() {
- if (search_control._markerLoc !== undefined)
- search_control._markerLoc.hide();
- });
- layer_control.addTo(map);
-
- $("#progress").html("Loading marker info...");
- $.ajax({
- url: 'api/markers/get'
- }).done(function(data) {
- $("#progress").html("Processing marker info...");
- try {
- eventmap_process_update(data);
- } catch (e) {
- if (e instanceof LoadingException) {
- $("#progress").html("Error: " + e.message);
- } else {
- $("#progress").html("Unknown error while "
- + "loading marker info.");
- throw e;
- }
- return;
+
+ drawing_layer = new L.FeatureGroup();
+
+ layer = L.layerGroup([base_layer, drawing_layer]);
+ layers[layer_info.name] = layer;
+
+ if (first_layer) {
+ map.addLayer(layer);
+ first_layer = false;
+ }
+ });
+ var layer_control = L.control.layers(layers, {});
+ map.on('baselayerchange', function() {
+ if (search_control._markerLoc !== undefined)
+ search_control._markerLoc.hide();
+ });
+ layer_control.addTo(map);
+
+ $("#progress").html("Loading marker info...");
+ $.ajax({
+ url: 'api/markers/get'
+ }).done(function(data) {
+ $("#progress").html("Processing marker info...");
+ try {
+ eventmap_process_update(data);
+ } catch (e) {
+ if (e instanceof LoadingException) {
+ $("#progress").html("Error: " + e.message);
+ } else {
+ $("#progress").html("Unknown error while "
+ + "loading marker info.");
+ throw e;
}
- $("#progress").html("Loading complete.");
- setTimeout(function() {
- $("#overlay").hide();
- }, 300);
- }).fail(function() {
- $("#progress").html("Error retrieving marker info," +
- " please retry.");
- });
- },
- error: function(xhr, status_text, error) {
- console.log(status_text);
- console.log(error);
- }
+ return;
+ }
+ $("#progress").html("Loading complete.");
+ setTimeout(function() {
+ $("#overlay").hide();
+ }, 300);
+ }).fail(function() {
+ $("#progress").html("Error retrieving marker info," +
+ " please retry.");
+ });
});
});
diff --git a/web/js/layers.json b/web/js/layers.json
deleted file mode 100644
index 3ea038a..0000000
--- a/web/js/layers.json
+++ /dev/null
@@ -1,10 +0,0 @@
-[
- {
- "url": "http://{s}.tile.osm.org/{z}/{x}/{y}.png",
- "max_zoom": 4,
- "name": "OSM",
- "options": {
- "attribution": "&copy; <a href=\"http://osm.org/copyright\">OpenStreetMap</a> contributors"
- }
- }
-]