diff --git a/app/src/main/java/de/westnordost/streetcomplete/data/osm/download/OsmQuestDownload.java b/app/src/main/java/de/westnordost/streetcomplete/data/osm/download/OsmQuestDownload.java index 03df9d29c9..47ff442652 100644 --- a/app/src/main/java/de/westnordost/streetcomplete/data/osm/download/OsmQuestDownload.java +++ b/app/src/main/java/de/westnordost/streetcomplete/data/osm/download/OsmQuestDownload.java @@ -6,6 +6,7 @@ import java.util.Collection; import java.util.HashMap; import java.util.Iterator; +import java.util.List; import java.util.Map; import java.util.Set; import java.util.concurrent.Future; @@ -28,9 +29,12 @@ import de.westnordost.osmapi.map.data.BoundingBox; import de.westnordost.osmapi.map.data.Element; import de.westnordost.osmapi.map.data.LatLon; +import de.westnordost.streetcomplete.util.SphericalEarthMath; public class OsmQuestDownload { + public static final int MAX_GEOMETRY_LENGTH_IN_METERS = 500; + private static final String TAG = "QuestDownload"; // injections @@ -185,6 +189,18 @@ private boolean mayCreateQuestFrom( return false; } + // do not create quests that refer to geometry that is too long for a surveyor to be + // expected to survey + if(geometry.polylines != null) + { + double distance = 0; + for (List polyline : geometry.polylines) + { + distance += SphericalEarthMath.distance(polyline); + } + if(distance > MAX_GEOMETRY_LENGTH_IN_METERS) return false; + } + // do not create quests whose marker is at a blacklisted position if(blacklistedPositions != null && blacklistedPositions.contains(geometry.center)) {