Compare commits
No commits in common. "dev" and "feature/trainlines" have entirely different histories.
dev
...
feature/tr
8
.gitmodules
vendored
8
.gitmodules
vendored
@ -1,9 +1,3 @@
|
|||||||
[submodule "lifo-dijkstraserv"]
|
[submodule "lifo-dijkstraserv"]
|
||||||
path = lifo-dijkstraserv
|
path = lifo-dijkstraserv
|
||||||
url = https://git.notsyncing.net/markus/lifo-dijkstraserv.git
|
url = https://notsyncing.net:8080/markus/lifo-dijkstraserv.git
|
||||||
[submodule "htdocs/fa"]
|
|
||||||
path = htdocs/fa
|
|
||||||
url = https://github.com/FortAwesome/Font-Awesome
|
|
||||||
[submodule "htdocs/awesomemarkers"]
|
|
||||||
path = htdocs/awesomemarkers
|
|
||||||
url = https://github.com/lvoogdt/Leaflet.awesome-markers
|
|
||||||
|
@ -1 +0,0 @@
|
|||||||
Subproject commit 4fcacdfc82ed58f0173062851a4cda713845df82
|
|
@ -1 +0,0 @@
|
|||||||
Subproject commit fcec2d1b01ff069ac10500ac42e4478d20d21f4c
|
|
@ -1,16 +0,0 @@
|
|||||||
<?php
|
|
||||||
$fn = "/tmp/lifo_update_ts";
|
|
||||||
$ctime = time();
|
|
||||||
$ltime = (int)(file_get_contents($fn));
|
|
||||||
$ntime = $ltime + 60*1 * 30;
|
|
||||||
if (isset($_GET['force']))
|
|
||||||
$ntime = 0;
|
|
||||||
if ($ctime > $ntime) {
|
|
||||||
file_put_contents($fn, $ctime);
|
|
||||||
echo "Downloading... ";
|
|
||||||
flush();
|
|
||||||
system("cd /srv/http/maps.linux-forks.de/geojson/; ./update_all.sh");
|
|
||||||
} else {
|
|
||||||
echo "Next update in " . intval(($ntime - $ctime) / 60) . " minutes.";
|
|
||||||
}
|
|
||||||
?>
|
|
@ -1,19 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
function fetch() {
|
|
||||||
if [[ "$3" != "" ]]; then
|
|
||||||
fn="$3"
|
|
||||||
else
|
|
||||||
fn="$1"
|
|
||||||
fi
|
|
||||||
"./fetch_$1.sh" "$2" | json_reformat -m > "$fn.json.tmp"
|
|
||||||
rm -f "$fn.json"
|
|
||||||
mv "$fn.json.tmp" "$fn.json"
|
|
||||||
}
|
|
||||||
|
|
||||||
fetch streets
|
|
||||||
fetch city_outlines
|
|
||||||
fetch trainlines "Train Lines"
|
|
||||||
fetch trainlines "Access Paths" trainlines_access
|
|
||||||
fetch bodiesofwater "Rivers" rivers
|
|
||||||
fetch bodiesofwater "Oceans, Seas, and Lakes" oceans
|
|
@ -1,14 +1,14 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>LinuxWorks Minetest Map [beta]</title>
|
<title>LinuxWorks Minetest Map</title>
|
||||||
<meta charset="utf-8"/>
|
<meta charset="utf-8"/>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<link rel="stylesheet" href="fa/css/all.css">
|
<link rel="stylesheet" href="fa/css/all.css">
|
||||||
<link rel="stylesheet" href="awesomemarkers/dist/leaflet.awesome-markers.css">
|
<link rel="stylesheet" href="awesomemarkers/leaflet.awesome-markers.css">
|
||||||
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.6.0/dist/leaflet.css" integrity="sha512-xwE/Az9zrjBIphAcBb3F6JVqxf46+CDLwfLMHloNu6KEQCAWi6HcDUbeOfBIptF7tcCzusKFjFw2yuvEpDL9wQ==" crossorigin=""/>
|
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.6.0/dist/leaflet.css" integrity="sha512-xwE/Az9zrjBIphAcBb3F6JVqxf46+CDLwfLMHloNu6KEQCAWi6HcDUbeOfBIptF7tcCzusKFjFw2yuvEpDL9wQ==" crossorigin=""/>
|
||||||
<script src="https://unpkg.com/leaflet@1.6.0/dist/leaflet.js" integrity="sha512-gZwIG9x3wUXg2hdXF6+rVkLF/0Vi9U8D2Ntg4Ga5I5BZpVkVxlJWbSQtXPSiUTtC0TjtGOmxa1AJPuV0CPthew==" crossorigin=""></script>
|
<script src="https://unpkg.com/leaflet@1.6.0/dist/leaflet.js" integrity="sha512-gZwIG9x3wUXg2hdXF6+rVkLF/0Vi9U8D2Ntg4Ga5I5BZpVkVxlJWbSQtXPSiUTtC0TjtGOmxa1AJPuV0CPthew==" crossorigin=""></script>
|
||||||
<script src="awesomemarkers/dist/leaflet.awesome-markers.js"></script>
|
<script src="awesomemarkers/leaflet.awesome-markers.js"></script>
|
||||||
<!-- Streets -->
|
<!-- Streets -->
|
||||||
<script src='leafletjs/ctxtextpath.js'></script>
|
<script src='leafletjs/ctxtextpath.js'></script>
|
||||||
<script src='leafletjs/L.LabelTextCollision.js'></script>
|
<script src='leafletjs/L.LabelTextCollision.js'></script>
|
||||||
@ -48,7 +48,7 @@
|
|||||||
-ms-interpolation-mode: nearest-neighbor; /* IE8+ */
|
-ms-interpolation-mode: nearest-neighbor; /* IE8+ */
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<script src="mapscript.js?v3"></script>
|
<script src="mapscript.js"></script>
|
||||||
<script src="streeteditor.js"></script>
|
<script src="streeteditor.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -5,8 +5,6 @@ var polyconf_show_street_names = 5; // Zoom level for when to start showing stre
|
|||||||
var polyconf_show_cities = 5; /* City outlines will be filled on this level and further away */
|
var polyconf_show_cities = 5; /* City outlines will be filled on this level and further away */
|
||||||
var polyconf_show_districts = 4; /* Shown from polyconf_show_cities until this*/
|
var polyconf_show_districts = 4; /* Shown from polyconf_show_cities until this*/
|
||||||
|
|
||||||
var polyconf_show_oceans = 5; // Show ocean labels from zoom level
|
|
||||||
|
|
||||||
var dijkstraserv_base = "https://notsyncing.net/dijkstra/";
|
var dijkstraserv_base = "https://notsyncing.net/dijkstra/";
|
||||||
var wikiurl_base = "https://wiki.linux-forks.de/mediawiki/index.php/"
|
var wikiurl_base = "https://wiki.linux-forks.de/mediawiki/index.php/"
|
||||||
var tiles_base = "https://notsyncing.net/maps.linux-forks.de/tiles/"
|
var tiles_base = "https://notsyncing.net/maps.linux-forks.de/tiles/"
|
||||||
@ -15,14 +13,12 @@ var streetLabelsRenderer = new L.StreetLabels({
|
|||||||
collisionFlg: true,
|
collisionFlg: true,
|
||||||
propertyName: 'name',
|
propertyName: 'name',
|
||||||
showLabelIf: function (layer) {
|
showLabelIf: function (layer) {
|
||||||
switch (layer.feature.geometry.type) {
|
switch (layer.geometry.type) {
|
||||||
case "LineString":
|
case "LineString":
|
||||||
if (mymap.getZoom() <= polyconf_show_street_names)
|
if (mymap.getZoom() <= polyconf_show_street_names)
|
||||||
return false;
|
return false;
|
||||||
break;
|
break;
|
||||||
case "Polygon":
|
case "Polygon":
|
||||||
if (layer.myName == "Oceans")
|
|
||||||
return (mymap.getZoom() > polyconf_show_oceans);
|
|
||||||
if (mymap.getZoom() > polyconf_show_street_names)
|
if (mymap.getZoom() > polyconf_show_street_names)
|
||||||
return false;
|
return false;
|
||||||
break;
|
break;
|
||||||
@ -38,7 +34,7 @@ var streetLabelsRenderer = new L.StreetLabels({
|
|||||||
fontSizeUnit: "px",
|
fontSizeUnit: "px",
|
||||||
lineWidth: 3.0,
|
lineWidth: 3.0,
|
||||||
fillStyle: "black",
|
fillStyle: "black",
|
||||||
strokeStyle: "white"
|
strokeStyle: "white",
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -52,44 +48,38 @@ streetLabelsRenderer._getCollisionFlag = function (layer) {
|
|||||||
streetLabelsRenderer._getDynamicFontSize = function (layer) {
|
streetLabelsRenderer._getDynamicFontSize = function (layer) {
|
||||||
zoom = mymap.getZoom();
|
zoom = mymap.getZoom();
|
||||||
|
|
||||||
switch (layer.myName) {
|
switch (layer.geometry.type) {
|
||||||
case "Oceans":
|
case "LineString":
|
||||||
return size *= 2.0/3;;
|
if (zoom <= 8)
|
||||||
|
return 11;
|
||||||
|
else
|
||||||
|
return 2**(zoom - 9) * 11;
|
||||||
break;
|
break;
|
||||||
default:
|
case "Polygon":
|
||||||
switch (layer.feature.geometry.type) {
|
var size;
|
||||||
case "LineString":
|
if (zoom >= 4)
|
||||||
if (zoom <= 8)
|
size = 30;
|
||||||
return 11;
|
else
|
||||||
else
|
size = 20;
|
||||||
return 2**(zoom - 9) * 11;
|
switch (layer.properties.type) {
|
||||||
|
case "city":
|
||||||
|
break;
|
||||||
|
case "town":
|
||||||
|
size *= 2.0/3.0;
|
||||||
|
break;
|
||||||
|
case "village":
|
||||||
|
size *= 1.5/3;
|
||||||
|
break;
|
||||||
|
case "district":
|
||||||
|
size *= 2.0/3;
|
||||||
break;
|
break;
|
||||||
case "Polygon":
|
|
||||||
var size;
|
|
||||||
if (zoom >= 4)
|
|
||||||
size = 30;
|
|
||||||
else
|
|
||||||
size = 20;
|
|
||||||
switch (layer.feature.properties.type) {
|
|
||||||
case "city":
|
|
||||||
break;
|
|
||||||
case "town":
|
|
||||||
size *= 2.0/3.0;
|
|
||||||
break;
|
|
||||||
case "village":
|
|
||||||
size *= 1.5/3;
|
|
||||||
break;
|
|
||||||
case "district":
|
|
||||||
size *= 2.0/3;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
size *= 0.5/3;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return size;
|
|
||||||
default:
|
default:
|
||||||
|
size *= 0.5/3;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
return size;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return 10;
|
return 10;
|
||||||
}
|
}
|
||||||
@ -105,24 +95,6 @@ var style_outlines = {
|
|||||||
var style_streets = {
|
var style_streets = {
|
||||||
};
|
};
|
||||||
|
|
||||||
var style_trains = {
|
|
||||||
color: "yellow"
|
|
||||||
};
|
|
||||||
|
|
||||||
var style_tech = {
|
|
||||||
color: "red"
|
|
||||||
};
|
|
||||||
|
|
||||||
var style_rivers = {
|
|
||||||
color: "blue",
|
|
||||||
fillColor: "#00999955",
|
|
||||||
};
|
|
||||||
|
|
||||||
var style_oceans = {
|
|
||||||
color: "#00556655",
|
|
||||||
fillColor: "#00999955",
|
|
||||||
};
|
|
||||||
|
|
||||||
var style_route = {
|
var style_route = {
|
||||||
radius: 8,
|
radius: 8,
|
||||||
fillColor: "#00ff00",
|
fillColor: "#00ff00",
|
||||||
@ -204,7 +176,7 @@ function load_tiles(name, id) {
|
|||||||
if (name != "") {
|
if (name != "") {
|
||||||
url = tiles_base + '{id}/{z}/{y}/{x}.png';
|
url = tiles_base + '{id}/{z}/{y}/{x}.png';
|
||||||
}
|
}
|
||||||
var satellite = new L.TileLayer(url, {
|
var satellite = L.tileLayer(url, {
|
||||||
maxZoom: 14 /*8*/,
|
maxZoom: 14 /*8*/,
|
||||||
maxNativeZoom: 6,
|
maxNativeZoom: 6,
|
||||||
minNativeZoom: 0,
|
minNativeZoom: 0,
|
||||||
@ -223,7 +195,6 @@ function load_tiles(name, id) {
|
|||||||
|
|
||||||
var current_location = "";
|
var current_location = "";
|
||||||
var current_feature = null;
|
var current_feature = null;
|
||||||
var current_layer = null;
|
|
||||||
function load_geojson(name, url, geotype, iconcolor, active=1, style={}) {
|
function load_geojson(name, url, geotype, iconcolor, active=1, style={}) {
|
||||||
var xhttp_ps = new XMLHttpRequest();
|
var xhttp_ps = new XMLHttpRequest();
|
||||||
xhttp_ps.onreadystatechange = function() {
|
xhttp_ps.onreadystatechange = function() {
|
||||||
@ -235,14 +206,10 @@ function load_geojson(name, url, geotype, iconcolor, active=1, style={}) {
|
|||||||
|
|
||||||
switch (geotype) {
|
switch (geotype) {
|
||||||
case "street":
|
case "street":
|
||||||
case "train":
|
|
||||||
onEachFeature = function(feature, layer) {
|
onEachFeature = function(feature, layer) {
|
||||||
layer.myTag = geotype;
|
layer.myTag = geotype;
|
||||||
layer.myName = name;
|
layer.myName = name;
|
||||||
if (geotype == "train")
|
|
||||||
layer.no_search = true
|
|
||||||
layer.on("click", function (e) {
|
layer.on("click", function (e) {
|
||||||
current_layer = layer;
|
|
||||||
current_feature = feature;
|
current_feature = feature;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@ -258,7 +225,6 @@ function load_geojson(name, url, geotype, iconcolor, active=1, style={}) {
|
|||||||
break;
|
break;
|
||||||
default: /* else it is a marker with the specified icon */
|
default: /* else it is a marker with the specified icon */
|
||||||
onEachFeature = function(feature, layer) {
|
onEachFeature = function(feature, layer) {
|
||||||
layer.myName = name;
|
|
||||||
label = String(feature.properties.name)
|
label = String(feature.properties.name)
|
||||||
layer.bindPopup('<h1><a target="_blank" href="' + wikiurl_base + feature.properties.name + '">' + feature.properties.name + '</a> (' + feature.geometry.coordinates + ')</h1>' + '<p><img style="width:100%" src="' + feature.properties.image + '"></p>' + '<p>' + feature.properties.description + '</p>');
|
layer.bindPopup('<h1><a target="_blank" href="' + wikiurl_base + feature.properties.name + '">' + feature.properties.name + '</a> (' + feature.geometry.coordinates + ')</h1>' + '<p><img style="width:100%" src="' + feature.properties.image + '"></p>' + '<p>' + feature.properties.description + '</p>');
|
||||||
layer.bindTooltip(label, {
|
layer.bindTooltip(label, {
|
||||||
@ -357,29 +323,13 @@ function load_geojson(name, url, geotype, iconcolor, active=1, style={}) {
|
|||||||
xhttp_ps.send();
|
xhttp_ps.send();
|
||||||
}
|
}
|
||||||
|
|
||||||
load_tiles("Satellite (2020-12-13)", 'world-2020-12-13').addTo(mymap);
|
load_tiles("Satellite (2020-04-09)", 'world-2020-04-09').addTo(mymap);
|
||||||
load_tiles("Satellite (2020-11-20)", 'world-2020-11-20');
|
load_tiles("Satellite (2019-05-04, wrong coords)", 'world-2019-05-04');
|
||||||
load_tiles("Satellite (2020-08-30)", 'world-2020-08-30');
|
|
||||||
load_tiles("Satellite (2020-06-04)", 'world-2020-06-04');
|
|
||||||
load_tiles("Satellite (2020-04-26)", 'world-2020-04-26');
|
|
||||||
load_tiles("Satellite (2020-04-09)", 'world-2020-04-09');
|
|
||||||
load_tiles("None", '');
|
load_tiles("None", '');
|
||||||
|
|
||||||
load_geojson("All", "./geojson/all.json", "auto", "auto", 0);
|
load_geojson("All", "./geojson/all.json", "auto", "auto", 0);
|
||||||
load_geojson("Streets", "./geojson/streets.json", "street", "auto", 1, style_streets);
|
load_geojson("Streets", "./geojson/streets.json", "street", "auto", 1, style_streets);
|
||||||
load_geojson("Trainlines (beta)", "./geojson/trainlines.json", "train", "auto", 1, style_trains);
|
|
||||||
load_geojson("TL Access (tech layer)", "./geojson/trainlines_access.json", "train", "auto", 0, style_tech);
|
|
||||||
load_geojson("Railroad Tracks", "./geojson/trains.json", "train", "auto", 0, style_trains);
|
|
||||||
load_geojson("Cities", "./geojson/city_outlines.json", "outline", "auto", 1, style_outlines);
|
load_geojson("Cities", "./geojson/city_outlines.json", "outline", "auto", 1, style_outlines);
|
||||||
load_geojson("Rivers", "./geojson/rivers.json", "street", "auto", 1, style_rivers);
|
|
||||||
load_geojson("Oceans", "./geojson/oceans.json", "outline", "auto", 1, style_oceans);
|
|
||||||
|
|
||||||
function update_geojson() {
|
|
||||||
var xhttp_ps = new XMLHttpRequest();
|
|
||||||
xhttp_ps.open("GET", "https://notsyncing.net/maps.linux-forks.de/geojson/update.php", true);
|
|
||||||
xhttp_ps.send();
|
|
||||||
}
|
|
||||||
update_geojson();
|
|
||||||
|
|
||||||
L.control.scale().addTo(mymap);
|
L.control.scale().addTo(mymap);
|
||||||
|
|
||||||
@ -437,11 +387,7 @@ function build_sidebar() {
|
|||||||
route_element.style.overflow = "scroll";
|
route_element.style.overflow = "scroll";
|
||||||
route_element.style.padding = "6px";
|
route_element.style.padding = "6px";
|
||||||
route_element.style.height = "100%";
|
route_element.style.height = "100%";
|
||||||
route_element.innerHTML = '<a href="#" onclick="toggle_search(\'search\',1);return false;"><-- Return to search<br><br></a>\
|
route_element.innerHTML = '<a href="#" onclick="toggle_search(\'search\',1);return false;"><-- Return to search<br></a><input style="width:100%;" id="route_start" name="lifo_route_loc" type="search" placeholder="Start at x,y"><br><input style="width:100%;" id="route_destination" name="lifo_route_loc" type="search" placeholder="Go to x,y"><br><input id="route_submit" type="button" style="width:100%;" value="Go!" onclick="route(event)"><div id="route_results"></div>';
|
||||||
<input style="width:100%;" id="route_start" name="lifo_route_loc" type="search" placeholder="Start at x,y"><br>\
|
|
||||||
<input style="width:100%;" id="route_destination" name="lifo_route_loc" type="search" placeholder="Go to x,y"><br>\
|
|
||||||
<input type="checkbox" name="use_trains" id="use_trains" value="trains" checked disabled=true><label for="use_trains"> Use trains (only S12)</label><br>\
|
|
||||||
<input id="route_submit" type="button" style="width:100%;" value="Go!" onclick="route(event)"><div id="route_results"></div>';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -505,8 +451,6 @@ function search(e) {
|
|||||||
|
|
||||||
for (key in layers._layers[i].layer._layers) {
|
for (key in layers._layers[i].layer._layers) {
|
||||||
item = layers._layers[i].layer._layers[key];
|
item = layers._layers[i].layer._layers[key];
|
||||||
if (item.hasOwnProperty("no_search"))
|
|
||||||
break;
|
|
||||||
switch (item.feature.geometry.type) {
|
switch (item.feature.geometry.type) {
|
||||||
case "Point":
|
case "Point":
|
||||||
regex = new RegExp(query, 'i');
|
regex = new RegExp(query, 'i');
|
||||||
@ -589,7 +533,7 @@ function route(e) // BOOKMARK
|
|||||||
last_through = "";
|
last_through = "";
|
||||||
geojson.eachLayer( function(layer) {
|
geojson.eachLayer( function(layer) {
|
||||||
if (last_through != layer.feature.properties.through) {
|
if (last_through != layer.feature.properties.through) {
|
||||||
str += '<li><a href="#" onclick="latLng2 = L.latLng(' + layer.feature.geometry.coordinates[0][1] + ',' + layer.feature.geometry.coordinates[0][0] + '); jump_to(latLng2); return false;">' + htmlEntities(layer.feature.properties.description).replace('[T]', '🚆️') + "</a></li>";
|
str += '<li><a href="#" onclick="latLng2 = L.latLng(' + layer.feature.geometry.coordinates[0][1] + ',' + layer.feature.geometry.coordinates[0][0] + '); jump_to(latLng2); return false;">' + htmlEntities(layer.feature.properties.description) + "</a></li>";
|
||||||
last_through = layer.feature.properties.through;
|
last_through = layer.feature.properties.through;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -695,29 +639,19 @@ var baseballIcon = L.AwesomeMarkers.icon({
|
|||||||
markerColor: 'red'
|
markerColor: 'red'
|
||||||
});
|
});
|
||||||
|
|
||||||
function escapeHtml(text) {
|
|
||||||
return text
|
|
||||||
.replace(/&/g, "&")
|
|
||||||
.replace(/</g, "<")
|
|
||||||
.replace(/>/g, ">")
|
|
||||||
.replace(/"/g, """)
|
|
||||||
.replace(/'/g, "'");
|
|
||||||
}
|
|
||||||
|
|
||||||
function onMapClick(e) {
|
function onMapClick(e) {
|
||||||
var addinfo = "";
|
var addinfo = "";
|
||||||
pos = resolve_latlng(e.latlng);
|
pos = resolve_latlng(e.latlng);
|
||||||
route_links = '<br><a href="#" onclick="latLng2 = L.latLng(' + pos.lng + ',' + pos.lat + '); set_route_start(latLng2); return false;">[route from here]</a>';
|
route_links = '<br><a href="#" onclick="latLng2 = L.latLng(' + pos.lng + ',' + pos.lat + '); set_route_start(latLng2); return false;">[route from here]</a>';
|
||||||
route_links += ' <a href="#" onclick="latLng2 = L.latLng(' + pos.lng + ',' + pos.lat + '); set_route_destination(latLng2); return false;">[route to here]</a>';
|
route_links += ' <a href="#" onclick="latLng2 = L.latLng(' + pos.lng + ',' + pos.lat + '); set_route_destination(latLng2); return false;">[route to here]</a>';
|
||||||
if (current_location != "")
|
if (current_location != "")
|
||||||
addinfo = " (part of <a target=\"_blank\" href=\"" + wikiurl_base + encodeURIComponent(current_location) + "\">" + escapeHtml(current_location) + "</a>)";
|
addinfo = " (part of <a target=\"_blank\" href='" + wikiurl_base + current_location + "'>" + current_location + "</a>)";
|
||||||
if (current_feature) {
|
if (current_feature) {
|
||||||
popup.setLatLng(e.latlng).setContent("This is <a target=\"_blank\" href=\"" + wikiurl_base + current_layer.myName + ":" + encodeURIComponent(current_feature.properties.name) + "\">" + escapeHtml(current_feature.properties.name) + "</a>" + addinfo + route_links).openOn(mymap);
|
popup.setLatLng(e.latlng).setContent("This is " + current_feature.properties.name + addinfo + route_links).openOn(mymap);
|
||||||
} else {
|
} else {
|
||||||
popup.setLatLng(e.latlng).setContent("You clicked the map at " + pos.lng + "," + pos.lat + addinfo + route_links).openOn(mymap);
|
popup.setLatLng(e.latlng).setContent("You clicked the map at " + pos.lng + "," + pos.lat + addinfo + route_links).openOn(mymap);
|
||||||
}
|
}
|
||||||
current_feature = null;
|
current_feature = null;
|
||||||
current_layer = null;
|
|
||||||
current_location = "";
|
current_location = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit faa5d7ca4b9b16442de4bd3c3cc49567cfd56598
|
Subproject commit 6d252d7755287295828d768f09869b179185914d
|
@ -1,62 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
|
|
||||||
OUTDIR=`pwd`/tiles
|
|
||||||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
|
|
||||||
|
|
||||||
mode="$1"
|
|
||||||
|
|
||||||
if [ "$mode" == "legacy" ]; then
|
|
||||||
MAPSERVER='http://old-maps.li-fo.de/'
|
|
||||||
FILES=`curl "$MAPSERVER" | sed -n 's/.*<a href="\([^\.]\+\.png\).*/\1/p'`
|
|
||||||
else
|
|
||||||
MAPSERVER='https://lifomaps.de'
|
|
||||||
FILES=`curl "$MAPSERVER" | sed -n 's/.*>\(world-[0-9\-]\+\.png\).*/\1/p'`
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ "$FILES" == "" ]]; then
|
|
||||||
echo "ERROR: Could not detect latest map file."
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
for FILE in $FILES; do
|
|
||||||
REMOTE_URL="$MAPSERVER/$FILE"
|
|
||||||
LOCAL_FILE="`echo $FILE | sed 's#.*/##'`"
|
|
||||||
LOCAL_URL="$OUTDIR/$LOCAL_FILE"
|
|
||||||
MAPNAME=`echo $LOCAL_URL | sed 's/.*\/\([^\.]\+\).*/\1/g'`
|
|
||||||
|
|
||||||
echo "# Downloading and converting $MAPNAME."
|
|
||||||
|
|
||||||
mkdir -p $OUTDIR
|
|
||||||
cd $OUTDIR
|
|
||||||
|
|
||||||
if [ ! -d "$OUTDIR/$MAPNAME" ]; then
|
|
||||||
echo "Downloading latest map file..."
|
|
||||||
curl -C - "$REMOTE_URL" -o "$LOCAL_URL"
|
|
||||||
|
|
||||||
if [ "$mode" == "legacy" ]; then
|
|
||||||
echo "Patching map (for map exports prior to 2019-07-09)..."
|
|
||||||
OSIZE=`file $LOCAL_URL | sed -n 's/.*PNG image data, \([0-9]\+\).*/\1/p'`
|
|
||||||
NSIZE=$(($OSIZE+1008))
|
|
||||||
RESIZED_URL="$LOCAL_URL-temp.png"
|
|
||||||
convert $LOCAL_URL -gravity SouthEast -extent ${NSIZE}x${NSIZE} $RESIZED_URL
|
|
||||||
rm $LOCAL_URL
|
|
||||||
mv $RESIZED_URL $LOCAL_URL
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Resizing map..."
|
|
||||||
OSIZE=`file $LOCAL_URL | sed -n 's/.*PNG image data, \([0-9]\+\).*/\1/p'`
|
|
||||||
NSIZE=$((2**6 * 256))
|
|
||||||
RESIZED_URL="$LOCAL_URL-resized.png"
|
|
||||||
convert $LOCAL_URL -extent ${NSIZE}x${NSIZE} -gravity NorthWest $RESIZED_URL
|
|
||||||
|
|
||||||
echo "Converting map..."
|
|
||||||
$SCRIPT_DIR/convert_maps.sh $MAPNAME $RESIZED_URL
|
|
||||||
|
|
||||||
echo "Cleaning up..."
|
|
||||||
rm $RESIZED_URL
|
|
||||||
rm $LOCAL_URL
|
|
||||||
else
|
|
||||||
echo "Skipping $MAPNAME."
|
|
||||||
fi
|
|
||||||
done
|
|
@ -11,8 +11,8 @@
|
|||||||
# `convert $MAPFILE -extent ${crop}x${crop} -gravity NorthWest $MAPFILE.scaled.png`
|
# `convert $MAPFILE -extent ${crop}x${crop} -gravity NorthWest $MAPFILE.scaled.png`
|
||||||
|
|
||||||
TILESIZE=256
|
TILESIZE=256
|
||||||
MAPNAME="$1"
|
MAPNAME="world-2020-04-09"
|
||||||
MAPFILE="$2"
|
MAPFILE="../$MAPNAME.png"
|
||||||
|
|
||||||
width=`file "$MAPFILE" | sed -n "s/.* \([0-9]\+\) x \([0-9]\+\).*/\1/p"`
|
width=`file "$MAPFILE" | sed -n "s/.* \([0-9]\+\) x \([0-9]\+\).*/\1/p"`
|
||||||
crop=$TILESIZE
|
crop=$TILESIZE
|
||||||
|
@ -9,7 +9,7 @@ categories=""
|
|||||||
|
|
||||||
data=`curl -s "$1"`
|
data=`curl -s "$1"`
|
||||||
|
|
||||||
temp=`echo "$data" | sed -n 's/<p>\(.\+\).*/\1/p' | grep -v -e '^<br />$' | sed 's#^</p>##' | head -n1`
|
temp=`echo "$data" | sed -n 's/<p>\(.\+\).*/\1/p' | head -n1`
|
||||||
if [ "$temp" != "" ]; then
|
if [ "$temp" != "" ]; then
|
||||||
temp=`echo "$temp" | sed "s#href=\"#href=\"$BASE#g" | sed 's/"/\\\\"/g' | sed 's/\t//g'`
|
temp=`echo "$temp" | sed "s#href=\"#href=\"$BASE#g" | sed 's/"/\\\\"/g' | sed 's/\t//g'`
|
||||||
description="$temp"
|
description="$temp"
|
||||||
|
@ -1,4 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
LIFO_SERVER="https://wiki.linux-forks.de"
|
|
||||||
CURLOPTS=( '-b' "/etc/lifomapserver/cookies.txt" )
|
|
@ -1,64 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
source common.sh
|
|
||||||
|
|
||||||
json=`curl ${CURLOPTS[@]} $LIFO_SERVER'/api.php?action=query&prop=revisions&rvprop=content&format=json&titles=Maps:BodiesOfWater'`
|
|
||||||
data=`echo "$json" | json_reformat | sed -e 's/\\\\n//g' -n -e 's/begin:mapdata\([^}]\+\)/\1/gp' | sed -e "s/|-|/}/g"`
|
|
||||||
|
|
||||||
section=""
|
|
||||||
echo "["
|
|
||||||
export IFS="}"
|
|
||||||
for entry in $data; do
|
|
||||||
this_section=`echo $entry | sed -n 's/.*== \([^=]\+\) ==.*/\1/p'`
|
|
||||||
if [[ "$this_section" != "" ]]; then
|
|
||||||
section=$this_section
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ "$section" != "$1" ]]; then
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
|
|
||||||
case "$section" in
|
|
||||||
"Rivers")
|
|
||||||
name=`echo "$entry" | sed -n 's/\s*\([^|]\+\).*/\1/p' | sed 's/ $//'`
|
|
||||||
type=`echo "$entry" | sed -n 's/\s*\([^|]\+\)||\s*\([^|]\+\).*/\2/p' | sed 's/ $//'`
|
|
||||||
coord=`echo "$entry" | sed -n 's/.*||\s*\([^|]\+\).*/\1/p'`
|
|
||||||
if [[ "$name" != "" && "$coord" != "" ]]; then
|
|
||||||
echo "{ \"type\": \"Feature\",
|
|
||||||
\"geometry\": {
|
|
||||||
\"type\": \"LineString\",
|
|
||||||
\"coordinates\": [
|
|
||||||
$coord
|
|
||||||
]
|
|
||||||
},
|
|
||||||
\"properties\": {
|
|
||||||
\"name\": \"$name\",
|
|
||||||
\"type\": \"$type\"
|
|
||||||
}
|
|
||||||
},"
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
"Oceans, Seas, and Lakes")
|
|
||||||
name=`echo "$entry" | sed -n 's/\s*\([^|]\+\).*/\1/p' | sed 's/ $//'`
|
|
||||||
type=`echo "$entry" | sed -n 's/\s*\([^|]\+\)||\s*\([^|]\+\).*/\2/p' | sed 's/ $//'`
|
|
||||||
coord=`echo "$entry" | sed -n 's/.*||\s*\([^|]\+\).*/\1/p'`
|
|
||||||
if [[ "$name" != "" && "$coord" != "" ]]; then
|
|
||||||
echo "{ \"type\": \"Feature\",
|
|
||||||
\"geometry\": {
|
|
||||||
\"type\": \"Polygon\",
|
|
||||||
\"coordinates\": [[
|
|
||||||
$coord
|
|
||||||
]]
|
|
||||||
},
|
|
||||||
\"properties\": {
|
|
||||||
\"name\": \"$name\",
|
|
||||||
\"type\": \"$type\"
|
|
||||||
}
|
|
||||||
},"
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
export IFS=" "
|
|
||||||
echo "{}"
|
|
||||||
echo "]"
|
|
@ -1,8 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
source common.sh
|
json=`curl 'https://wiki.linux-forks.de/mediawiki/api.php?action=query&prop=revisions&rvprop=content&format=json&titles=Maps:Cities'`
|
||||||
|
|
||||||
json=`curl ${CURLOPTS[@]} $LIFO_SERVER'/api.php?action=query&prop=revisions&rvprop=content&format=json&titles=Maps:Cities'`
|
|
||||||
data=`echo "$json" | json_reformat | sed -e 's/\\\\n//g' -n -e 's/begin:mapdata\([^}]\+\)/\1/gp' | sed -e "s/|-|/}/g"`
|
data=`echo "$json" | json_reformat | sed -e 's/\\\\n//g' -n -e 's/begin:mapdata\([^}]\+\)/\1/gp' | sed -e "s/|-|/}/g"`
|
||||||
|
|
||||||
echo "["
|
echo "["
|
||||||
|
@ -2,9 +2,7 @@
|
|||||||
|
|
||||||
# WARNING: This script is not yet production ready. The slightest error in the wikipage can throw it off. Handle with care.
|
# WARNING: This script is not yet production ready. The slightest error in the wikipage can throw it off. Handle with care.
|
||||||
|
|
||||||
source common.sh
|
json=`curl 'https://wiki.linux-forks.de/mediawiki/api.php?action=query&prop=revisions&rvprop=content&format=json&titles=Maps:Streets'`
|
||||||
|
|
||||||
json=`curl ${CURLOPTS[@]} $LIFO_SERVER'/api.php?action=query&prop=revisions&rvprop=content&format=json&titles=Maps:Streets'`
|
|
||||||
data=`echo "$json" | json_reformat | sed -e 's/\\\\n//g' -n -e 's/begin:mapdata\([^}]\+\)/\1/gp' | sed -e "s/|-|/}/g"`
|
data=`echo "$json" | json_reformat | sed -e 's/\\\\n//g' -n -e 's/begin:mapdata\([^}]\+\)/\1/gp' | sed -e "s/|-|/}/g"`
|
||||||
|
|
||||||
echo "["
|
echo "["
|
||||||
|
@ -1,68 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
source common.sh
|
|
||||||
|
|
||||||
json=`curl ${CURLOPTS[@]} $LIFO_SERVER'/api.php?action=query&prop=revisions&rvprop=content&format=json&titles=Maps:Trainlines'`
|
|
||||||
data=`echo "$json" | json_reformat | sed -e 's/\\\\n//g' -n -e 's/begin:mapdata\([^}]\+\)/\1/gp' | sed -e "s/|-|/}/g"`
|
|
||||||
|
|
||||||
section=""
|
|
||||||
echo "["
|
|
||||||
export IFS="}"
|
|
||||||
for entry in $data; do
|
|
||||||
this_section=`echo $entry | sed -n 's/.*== \([^=]\+\) ==.*/\1/p'`
|
|
||||||
if [[ "$this_section" != "" ]]; then
|
|
||||||
section=$this_section
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ "$section" != "$1" ]]; then
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
|
|
||||||
case "$section" in
|
|
||||||
"Train Lines")
|
|
||||||
name=`echo "$entry" | sed -n 's/\s*\([^|]\+\).*/\1/p' | sed 's/ $//'`
|
|
||||||
start=`echo "$entry" | sed -n 's/\s*\([^|]\+\)||\s*\([^|]\+\).*/\2/p' | sed 's/ $//'`
|
|
||||||
end=`echo "$entry" | sed -n 's/\s*\([^|]\+\)||\([^|]\+\)||\s*\([^|]\+\).*/\3/p' | sed 's/ $//'`
|
|
||||||
coord=`echo "$entry" | sed -n 's/.*||\s*\([^|]\+\).*/\1/p'`
|
|
||||||
if [[ "$name" != "" && "$coord" != "" ]]; then
|
|
||||||
echo "{ \"type\": \"Feature\",
|
|
||||||
\"geometry\": {
|
|
||||||
\"type\": \"LineString\",
|
|
||||||
\"coordinates\": [
|
|
||||||
$coord
|
|
||||||
]
|
|
||||||
},
|
|
||||||
\"properties\": {
|
|
||||||
\"name\": \"$name\",
|
|
||||||
\"start\": \"$start\",
|
|
||||||
\"end\": \"$end\"
|
|
||||||
}
|
|
||||||
},"
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
"Access Paths")
|
|
||||||
name=`echo "$entry" | sed -n 's/\s*\([^|]\+\).*/\1/p' | sed 's/ $//'`
|
|
||||||
lines=`echo "$entry" | sed -n 's/\s*\([^|]\+\)||\s*\([^|]\+\).*/\2/p' | sed 's/ $//'`
|
|
||||||
coord=`echo "$entry" | sed -n 's/.*||\s*\([^|]\+\).*/\1/p'`
|
|
||||||
if [[ "$type" == "district" ]]; then
|
|
||||||
continue;
|
|
||||||
fi
|
|
||||||
if [[ "$name" != "" && "$coord" != "" ]]; then
|
|
||||||
echo "{ \"type\": \"Feature\",
|
|
||||||
\"geometry\": {
|
|
||||||
\"type\": \"LineString\",
|
|
||||||
\"coordinates\": [
|
|
||||||
$coord
|
|
||||||
]
|
|
||||||
},
|
|
||||||
\"properties\": {
|
|
||||||
\"name\": \"$lines:$name\"
|
|
||||||
}
|
|
||||||
},"
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
export IFS=" "
|
|
||||||
echo "{}"
|
|
||||||
echo "]"
|
|
@ -1,21 +1,10 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
source common.sh
|
|
||||||
|
|
||||||
function fetch() {
|
function fetch() {
|
||||||
if [[ "$3" != "" ]]; then
|
"./fetch_$1.sh" | json_reformat -m > "$1.json.tmp"
|
||||||
fn="$3"
|
rm -f "$1.json"
|
||||||
else
|
mv "$1.json.tmp" "$1.json"
|
||||||
fn="$1"
|
|
||||||
fi
|
|
||||||
"./fetch_$1.sh" "$2" | json_reformat -m > "$fn.json.tmp"
|
|
||||||
rm -f "$fn.json"
|
|
||||||
mv "$fn.json.tmp" "$fn.json"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fetch streets
|
fetch streets
|
||||||
fetch city_outlines
|
fetch city_outlines
|
||||||
fetch trainlines "Train Lines"
|
|
||||||
fetch trainlines "Access Paths" trainlines_access
|
|
||||||
fetch bodiesofwater "Rivers" rivers
|
|
||||||
fetch bodiesofwater "Oceans, Seas, and Lakes" oceans
|
|
||||||
|
Loading…
Reference in New Issue
Block a user