Skip to content

Commit

Permalink
fix short/long detour factor
Browse files Browse the repository at this point in the history
  • Loading branch information
rakow committed Apr 24, 2024
1 parent a7f5992 commit 093845c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public synchronized ShpOptions.Index getIndex(String queryCRS) {
return index;


ShpOptions shp = ShpOptions.ofGeoPkg(facilityPath.toString(), null);
ShpOptions shp = ShpOptions.ofLayer(facilityPath.toString(), null);

index = shp.createIndex(queryCRS, attr, ft -> Boolean.TRUE.equals(ft.getAttribute(attr))
|| Objects.equals(ft.getAttribute(attr), 1));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,11 @@ private static Coord rndCoord(SplittableRandom rnd, double dist, Coord origin) {

/**
* Approximate beeline dist from known traveled distance. Distance will be reduced by a fixed detour factor.
* Dist in meter.
* @param travelDist distance in km
* @return beeline distance in meters
*/
public static double beelineDist(double travelDist) {
double detourFactor = travelDist <= 2000 ? DETOUR_FACTOR_SHORT : DETOUR_FACTOR;
double detourFactor = travelDist <= 2 ? DETOUR_FACTOR_SHORT : DETOUR_FACTOR;
return travelDist * 1000 / detourFactor;
}

Expand Down

0 comments on commit 093845c

Please sign in to comment.