From 1ddb72414082f60da2aa9742e14aaea965871093 Mon Sep 17 00:00:00 2001 From: Markus Koch Date: Sun, 26 Apr 2020 17:01:26 +0200 Subject: [PATCH] Give cities, towns, and villages different font sizes --- htdocs/mapscript.js | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/htdocs/mapscript.js b/htdocs/mapscript.js index 7d7d940..735dcd9 100644 --- a/htdocs/mapscript.js +++ b/htdocs/mapscript.js @@ -45,9 +45,28 @@ streetLabelsRenderer._getDynamicFontSize = function (layer) { return 2**(zoom - 9) * 11; break; case "Polygon": + var size; if (zoom >= 4) - return 30; - return 20; + size = 30; + else + size = 20; + switch (layer.properties.type) { + case "city": + break; + case "town": + size *= 2/3; + break; + case "village": + size *= 1/3; + break; + case "district": + size *= 2/3; + break; + default: + size *= 0.5/3; + break; + } + return size; default: break; }