Merge pull request #11150 from osmandapp/address_10877
Fix reverse geocoding for building only
This commit is contained in:
commit
68c07a3de4
1 changed files with 4 additions and 1 deletions
|
@ -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) {
|
if (streetDistance == 0) {
|
||||||
streetDistance = street.getDistance();
|
streetDistance = street.getDistance();
|
||||||
} else if (street.getDistance() > streetDistance + DISTANCE_STREET_FROM_CLOSEST_WITH_SAME_NAME) {
|
} else if (streetDistance > 0 && street.getDistance() > streetDistance + DISTANCE_STREET_FROM_CLOSEST_WITH_SAME_NAME &&
|
||||||
|
isBuildingFound) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
street.connectionPoint = road.connectionPoint;
|
street.connectionPoint = road.connectionPoint;
|
||||||
|
@ -296,6 +298,7 @@ public class GeocodingUtilities {
|
||||||
if (knownMinBuildingDistance == 0) {
|
if (knownMinBuildingDistance == 0) {
|
||||||
GeocodingResult firstBld = it.next();
|
GeocodingResult firstBld = it.next();
|
||||||
knownMinBuildingDistance = firstBld.getDistance();
|
knownMinBuildingDistance = firstBld.getDistance();
|
||||||
|
isBuildingFound = true;
|
||||||
res.add(firstBld);
|
res.add(firstBld);
|
||||||
}
|
}
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
|
|
Loading…
Reference in a new issue