Update multiplier
This commit is contained in:
parent
3ac68eb011
commit
055012198e
2 changed files with 17 additions and 8 deletions
|
@ -35,6 +35,13 @@ import org.apache.commons.logging.Log;
|
|||
public class GeocodingUtilities {
|
||||
|
||||
private static final Log log = PlatformUtil.getLog(GeocodingUtilities.class);
|
||||
|
||||
public static final float THRESHOLD_MULTIPLIER_SKIP_BUILDINGS_AFTER = 1.5f;
|
||||
public static final float THRESHOLD_MULTIPLIER_SKIP_STREETS_AFTER = 4;
|
||||
public static final float DISTANCE_STREET_NAME_PROXIMITY_BY_NAME = 15000;
|
||||
public static final float DISTANCE_BULDING_PROXIMITY = 100;
|
||||
public static final float DISTANCE_STREET_FROM_CLOSEST = 1000;
|
||||
|
||||
public static final String[] SUFFIXES = new String[] {"av.", "avenue", "просп.", "пер.", "пр.","заул.", "проспект", "переул.", "бул.", "бульвар", "тракт"};
|
||||
public static final String[] DEFAULT_SUFFIXES = new String[] {"str.", "street", "улица", "ул."};
|
||||
private static Set<String> SET_DEF_SUFFIXES = null;
|
||||
|
@ -56,10 +63,6 @@ public class GeocodingUtilities {
|
|||
return SET_SUFFIXES;
|
||||
}
|
||||
|
||||
public static final float THRESHOLD_MULTIPLIER_SKIP_BUILDINGS_AFTER = 1.5f;
|
||||
public static final float THRESHOLD_MULTIPLIER_SKIP_STREETS_AFTER = 3;
|
||||
public static final float DISTANCE_STREET_NAME_PROXIMITY_BY_NAME = 15000;
|
||||
public static final float DISTANCE_BULDING_PROXIMITY = 100;
|
||||
public static final Comparator<GeocodingResult> DISTANCE_COMPARATOR = new Comparator<GeocodingResult>() {
|
||||
|
||||
@Override
|
||||
|
@ -137,6 +140,8 @@ public class GeocodingUtilities {
|
|||
return bld.toString();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public List<GeocodingResult> reverseGeocodingSearch(RoutingContext ctx, double lat, double lon) throws IOException {
|
||||
RoutePlannerFrontEnd rp = new RoutePlannerFrontEnd(false);
|
||||
|
@ -268,7 +273,7 @@ public class GeocodingUtilities {
|
|||
for (GeocodingResult street : streetsList) {
|
||||
if(streetDistance == 0) {
|
||||
streetDistance = street.getDistance();
|
||||
} else if(street.getDistance() > streetDistance + 1000) {
|
||||
} else if(street.getDistance() > streetDistance + DISTANCE_STREET_FROM_CLOSEST) {
|
||||
continue;
|
||||
}
|
||||
street.connectionPoint = road.connectionPoint;
|
||||
|
|
|
@ -87,11 +87,15 @@ public class CurrentPositionHelper {
|
|||
}
|
||||
|
||||
protected void justifyResult(List<GeocodingResult> res, final ResultMatcher<GeocodingResult> result) {
|
||||
double minBuildingDistance = 0;
|
||||
List<GeocodingResult> complete = new ArrayList<GeocodingUtilities.GeocodingResult>();
|
||||
double minBuildingDistance = 0;
|
||||
double minStreetDistance = 0;
|
||||
for (GeocodingResult r : res) {
|
||||
if (minBuildingDistance > 0
|
||||
&& r.getDistance() > GeocodingUtilities.THRESHOLD_MULTIPLIER_SKIP_STREETS_AFTER * minBuildingDistance) {
|
||||
double streetDistance = r.getDistance();
|
||||
if(minStreetDistance == 0) {
|
||||
minStreetDistance = streetDistance;
|
||||
} else if(streetDistance > GeocodingUtilities.THRESHOLD_MULTIPLIER_SKIP_STREETS_AFTER * minStreetDistance ||
|
||||
streetDistance > minStreetDistance + GeocodingUtilities.DISTANCE_STREET_FROM_CLOSEST) {
|
||||
break;
|
||||
}
|
||||
Collection<RegionAddressRepository> rar = app.getResourceManager().getAddressRepositories();
|
||||
|
|
Loading…
Reference in a new issue