Search in Description of Polygons

This commit is contained in:
BlubbFish 2019-09-06 19:17:34 +02:00
parent 7c7e15e1b2
commit fa02c89674

View File

@ -203,7 +203,9 @@
if (MapObject.GeoJson.features.length > 0) {
for (var i = 0; i < MapObject.GeoJson.features.length; i++) {
var feature = MapObject.GeoJson.features[i];
if (feature.properties.name.toLowerCase().indexOf(searchtext.toLowerCase()) !== -1 && feature.geometry.type === "Polygon") {
if ((feature.properties.name.toLowerCase().indexOf(searchtext.toLowerCase()) !== -1 ||
(typeof feature.properties.description !== "undefined" && feature.properties.description.toLowerCase().indexOf(searchtext.toLowerCase()) !== -1)) &&
feature.geometry.type === "Polygon") {
if (feature.geometry.coordinates.length > 0 && feature.geometry.coordinates[0].length > 0 && feature.geometry.coordinates[0][0].length > 0) {
html += "<div class='result' onclick='MapObject.JumpTo(" + feature.geometry.coordinates[0][0][1] + "," + feature.geometry.coordinates[0][0][0]+");'><span class='text'>" +
"<span class='title'>" + feature.properties.name + "</span>" +