summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Koch <markus@notsyncing.net>2020-04-25 13:33:13 +0200
committerMarkus Koch <markus@notsyncing.net>2020-04-25 13:33:13 +0200
commit6ceae7d7c21197af3ffe73582e7f931507938596 (patch)
tree40627872c650ab98fddb571faedfc06a24feefaf
parent771704bf15515ac524724c20399a0b44ccc44531 (diff)
downloadlifomapserver-6ceae7d7c21197af3ffe73582e7f931507938596.tar.gz
lifomapserver-6ceae7d7c21197af3ffe73582e7f931507938596.tar.bz2
lifomapserver-6ceae7d7c21197af3ffe73582e7f931507938596.zip
Add polygons (city outlines) to search results
-rw-r--r--htdocs/mapscript.js10
1 files changed, 10 insertions, 0 deletions
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 + "] " + '<a href="#" onclick="latLng2 = L.latLng(' + Math.round(zpos.lat) + ',' + Math.round(zpos.lng) + '); jump_to(latLng2, ' + polyconf_show_cities + '); return false;">' + htmlEntities(item.feature.properties.name) + "</a>";
+ results.appendChild(el);
+ }
+ break;
default:
break;
}