From 6ceae7d7c21197af3ffe73582e7f931507938596 Mon Sep 17 00:00:00 2001 From: Markus Koch Date: Sat, 25 Apr 2020 13:33:13 +0200 Subject: [PATCH] Add polygons (city outlines) to search results --- htdocs/mapscript.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/htdocs/mapscript.js b/htdocs/mapscript.js index c70006f..73c7fb0 100644 --- a/htdocs/mapscript.js +++ b/htdocs/mapscript.js @@ -346,6 +346,16 @@ function search(e) { results.appendChild(el); } break; + case "Polygon": + regex = new RegExp(query, 'i'); + + if (item.feature.properties.name.match(regex)) { + el = document.createElement("li"); + zpos = layers._layers[i].layer._layers[item._leaflet_id].getCenter(); + el.innerHTML = "[" + layers._layers[i].name + "] " + '' + htmlEntities(item.feature.properties.name) + ""; + results.appendChild(el); + } + break; default: break; }