Fix reverse geocoding for building only

This commit is contained in:
ivanPyrohivskyi 2021-03-15 17:34:17 +02:00
parent a9423e5332
commit 27bd894e56

View file

@ -282,10 +282,12 @@ public class GeocodingUtilities {
} else { } else {
Collections.sort(streetsList, DISTANCE_COMPARATOR); Collections.sort(streetsList, DISTANCE_COMPARATOR);
double streetDistance = 0; double streetDistance = 0;
boolean isBuildingFound = knownMinBuildingDistance > 0;
for (GeocodingResult street : streetsList) { for (GeocodingResult street : streetsList) {
if (streetDistance == 0) { boolean skipStreet = streetDistance > 0 && street.getDistance() > streetDistance + DISTANCE_STREET_FROM_CLOSEST_WITH_SAME_NAME;
if (streetDistance == 0 || !isBuildingFound) {
streetDistance = street.getDistance(); streetDistance = street.getDistance();
} else if (street.getDistance() > streetDistance + DISTANCE_STREET_FROM_CLOSEST_WITH_SAME_NAME) { } else if (skipStreet) {
continue; continue;
} }
street.connectionPoint = road.connectionPoint; street.connectionPoint = road.connectionPoint;
@ -307,6 +309,9 @@ public class GeocodingUtilities {
res.add(nextBld); res.add(nextBld);
} }
} }
if (skipStreet) {
continue;
}
res.add(street); res.add(street);
} }
} }