summaryrefslogtreecommitdiff
path: root/htdocs/mapscript.js
diff options
context:
space:
mode:
Diffstat (limited to 'htdocs/mapscript.js')
-rw-r--r--htdocs/mapscript.js72
1 files changed, 43 insertions, 29 deletions
diff --git a/htdocs/mapscript.js b/htdocs/mapscript.js
index 1a4896c..cf45304 100644
--- a/htdocs/mapscript.js
+++ b/htdocs/mapscript.js
@@ -13,13 +13,14 @@ var streetLabelsRenderer = new L.StreetLabels({
collisionFlg: true,
propertyName: 'name',
showLabelIf: function (layer) {
- switch (layer.geometry.type) {
+ switch (layer.feature.geometry.type) {
case "LineString":
if (mymap.getZoom() <= polyconf_show_street_names)
return false;
break;
case "Polygon":
- if (mymap.getZoom() > polyconf_show_street_names)
+ if ((mymap.getZoom() > polyconf_show_street_names) &&
+ (layer.myName != "Oceans"))
return false;
break;
default:
@@ -48,38 +49,44 @@ streetLabelsRenderer._getCollisionFlag = function (layer) {
streetLabelsRenderer._getDynamicFontSize = function (layer) {
zoom = mymap.getZoom();
- switch (layer.geometry.type) {
- case "LineString":
- if (zoom <= 8)
- return 11;
- else
- return 2**(zoom - 9) * 11;
+ switch (layer.myName) {
+ case "Oceans":
+ return size *= 2.0/3;;
break;
- case "Polygon":
- var size;
- if (zoom >= 4)
- size = 30;
- else
- size = 20;
- 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;
+ default:
+ switch (layer.feature.geometry.type) {
+ case "LineString":
+ if (zoom <= 8)
+ return 11;
+ else
+ return 2**(zoom - 9) * 11;
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:
- size *= 0.5/3;
break;
}
- return size;
- default:
- break;
}
return 10;
}
@@ -103,6 +110,10 @@ var style_tech = {
color: "red"
};
+var style_rivers = {
+ color: "blue"
+ };
+
var style_route = {
radius: 8,
fillColor: "#00ff00",
@@ -236,6 +247,7 @@ function load_geojson(name, url, geotype, iconcolor, active=1, style={}) {
break;
default: /* else it is a marker with the specified icon */
onEachFeature = function(feature, layer) {
+ layer.myName = 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.bindTooltip(label, {
@@ -348,6 +360,8 @@ load_geojson("Trainlines (beta)", "./geojson/trainlines.json", "train", "auto",
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("Rivers", "./geojson/rivers.json", "street", "auto", 1, style_rivers);
+load_geojson("Oceans", "./geojson/oceans.json", "outline", "auto", 1, style_rivers);
function update_geojson() {
var xhttp_ps = new XMLHttpRequest();