Skip to content

Commit 8b9ab35

Browse files
authored
Merge pull request #5 from Trihydro/bug/empty-points-when-buffer-call-tries-computePointAtDistanceThreshold-with-only-junction-points
Fixes bug where the only points involved in computePointAtDistanceThreshold
2 parents acc5d09 + 2d3c588 commit 8b9ab35

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

config-example.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ graphhopper:
9292
# More are: surface,smoothness,max_width,max_height,max_weight,max_weight_except,hgv,max_axle_load,max_length,
9393
# hazmat,hazmat_tunnel,hazmat_water,lanes,osm_way_id,toll,track_type,mtb_rating,hike_rating,horse_rating,
9494
# country,curvature,average_slope,max_slope,car_temporal_access,bike_temporal_access,foot_temporal_access
95-
graph.encoded_values: car_access, car_average_speed
95+
graph.encoded_values: car_access, car_average_speed, road_access
9696

9797
#### Speed, hybrid and flexible mode ####
9898

web-bundle/src/main/java/com/graphhopper/resources/BufferResource.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -484,6 +484,14 @@ private PointList computePointAtDistanceThreshold(BufferFeature startFeature, Do
484484
EdgeIteratorState finalState = graph.getEdgeIteratorState(endFeature.getEdge(), Integer.MIN_VALUE);
485485
PointList pointList = finalState.fetchWayGeometry(FetchMode.PILLAR_ONLY);
486486

487+
// It is possible that the finalState.fetchWayGeometry(FetchMode.xxxx) would
488+
// only contain TOWER points and not PILLAR points.
489+
// When this happens, filtering by FetchMode.PILLAR_ONLY will return an empty
490+
// PointList.
491+
if (pointList.isEmpty()) {
492+
return pointList;
493+
}
494+
487495
// When the buffer is only as wide as a single edge, truncate one half of the
488496
// segment
489497
if (startFeature.getEdge().equals(endFeature.getEdge())) {

0 commit comments

Comments
 (0)