Add polygons (city outlines) to search results

This commit is contained in:
Markus Koch 2020-04-25 13:33:13 +02:00
parent 771704bf15
commit 6ceae7d7c2
1 changed files with 10 additions and 0 deletions

View File

@ -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;
}