@@ -31,14 +31,14 @@ public class BufferResourceTest {
31
31
private static GraphHopperServerConfiguration createConfig () {
32
32
GraphHopperServerConfiguration config = new GraphHopperServerTestConfiguration ();
33
33
config .getGraphHopperConfiguration ()
34
- .putObject ("datareader.file" , "../core/files/andorra.osm.pbf" )
35
- .putObject ("import.osm.ignored_highways" , "" )
36
- .putObject ("graph.location" , DIR )
37
- .putObject ("graph.encoded_values" , "car_access, car_average_speed" )
38
- .setProfiles (Arrays .asList (
39
- TestProfiles .accessAndSpeed ("fast_car" , "car" ).setTurnCostsConfig (TurnCostsConfig .car ()),
40
- TestProfiles .constantSpeed ("short_car" , 35 ).setTurnCostsConfig (TurnCostsConfig .car ()),
41
- TestProfiles .accessAndSpeed ("fast_car_no_turn_restrictions" , "car" )));
34
+ .putObject ("datareader.file" , "../core/files/andorra.osm.pbf" )
35
+ .putObject ("import.osm.ignored_highways" , "" )
36
+ .putObject ("graph.location" , DIR )
37
+ .putObject ("graph.encoded_values" , "car_access, car_average_speed" )
38
+ .setProfiles (Arrays .asList (
39
+ TestProfiles .accessAndSpeed ("fast_car" , "car" ).setTurnCostsConfig (TurnCostsConfig .car ()),
40
+ TestProfiles .constantSpeed ("short_car" , 35 ).setTurnCostsConfig (TurnCostsConfig .car ()),
41
+ TestProfiles .accessAndSpeed ("fast_car_no_turn_restrictions" , "car" )));
42
42
return config ;
43
43
}
44
44
@@ -333,4 +333,31 @@ public void testUnusualRoadNameFormat() {
333
333
assertEquals (200 , response .getStatus ());
334
334
}
335
335
}
336
+
337
+ @ Test
338
+ public void testOutOfRoad () {
339
+ // testing buffer on a road in Andorra that transitions from CG-1 to N-145
340
+ JsonFeatureCollection featureCollection ;
341
+ try (Response response = clientTarget (app , "/buffer?profile=my_car&"
342
+ + "point=42.440606,1.477431&roadName=cg-1&"
343
+ + "thresholdDistance=1600&buildUpstream=true&queryMultiplier=0.000075" ).request ()
344
+ .buildGet ().invoke ()) {
345
+ assertEquals (200 , response .getStatus ());
346
+ featureCollection = response .readEntity (JsonFeatureCollection .class );
347
+ }
348
+
349
+ assertEquals (2 , featureCollection .getFeatures ().size ());
350
+ Geometry lineString0 = featureCollection .getFeatures ().get (0 ).getGeometry ();
351
+ Geometry lineString1 = featureCollection .getFeatures ().get (1 ).getGeometry ();
352
+
353
+ // Identical start points (reversed index)
354
+ assertEquals (lineString0 .getCoordinates ()[lineString0 .getCoordinates ().length - 1 ],
355
+ lineString1 .getCoordinates ()[lineString1 .getCoordinates ().length - 1 ]);
356
+
357
+ // Different end points (reversed index)
358
+ assertNotEquals (lineString0 .getCoordinates ()[0 ], lineString1 .getCoordinates ()[0 ]);
359
+
360
+ // Check lengths are different since one path runs out of road
361
+ assertNotEquals (lineString0 .getLength (), lineString1 .getLength ());
362
+ }
336
363
}
0 commit comments