use of com.graphhopper.GraphHopper in project graphhopper by graphhopper.
the class RoutingAlgorithmWithOSMTest method testHarsdorf.
@Test
public void testHarsdorf() {
List<Query> queries = new ArrayList<>();
// TODO somehow the bigger road is take even if we make it less preferred (e.g. introduce AVOID AT ALL costs for lanes=2&&maxspeed>50)
queries.add(new Query(50.004333, 11.600254, 50.044449, 11.543434, 6952, 190));
// choose Unterloher Weg and the following residential + cycleway
// list.add(new OneRun(50.004333, 11.600254, 50.044449, 11.543434, 6931, 184));
GraphHopper hopper = createHopper(BAYREUTH, new Profile("bike").setVehicle("bike").setWeighting("fastest"));
hopper.importOrLoad();
checkQueries(hopper, queries);
}
use of com.graphhopper.GraphHopper in project graphhopper by graphhopper.
the class RoutingAlgorithmWithOSMTest method testNeudrossenfeld.
@Test
public void testNeudrossenfeld() {
List<Query> list = new ArrayList<>();
// choose cycleway (Dreschenauer Straße)
list.add(new Query(49.987132, 11.510496, 50.018839, 11.505024, 3985, 106));
GraphHopper hopper = createHopper(BAYREUTH, new Profile("bike").setVehicle("bike").setWeighting("fastest"));
hopper.setElevationProvider(new SRTMProvider(DIR));
hopper.importOrLoad();
checkQueries(hopper, list);
Helper.removeDir(new File(GH_LOCATION));
hopper = createHopper(BAYREUTH, new Profile("bike2").setVehicle("bike2").setWeighting("fastest"));
hopper.setElevationProvider(new SRTMProvider(DIR));
hopper.importOrLoad();
checkQueries(hopper, list);
}
use of com.graphhopper.GraphHopper in project graphhopper by graphhopper.
the class RoutingAlgorithmWithOSMTest method testCampoGrande.
@Test
public void testCampoGrande() {
// test not only NE quadrant of earth!
// bzcat campo-grande.osm.bz2
// | ./bin/osmosis --read-xml enableDateParsing=no file=- --bounding-box top=-20.4 left=-54.6 bottom=-20.6 right=-54.5 --write-xml file=-
// | bzip2 > campo-grande.extracted.osm.bz2
List<Query> queries = new ArrayList<>();
queries.add(new Query(-20.4001, -54.5999, -20.598, -54.54, 25323, 271));
queries.add(new Query(-20.43, -54.54, -20.537, -54.5999, 16231, 223));
GraphHopper hopper = createHopper(DIR + "/campo-grande.osm.gz", new Profile("car").setVehicle("car").setWeighting("shortest"));
hopper.importOrLoad();
checkQueries(hopper, queries);
}
use of com.graphhopper.GraphHopper in project graphhopper by graphhopper.
the class RoutingAlgorithmWithOSMTest method testSidewalkNo.
@Test
public void testSidewalkNo() {
List<Query> queries = new ArrayList<>();
// roundabout contains sidewalk=no which should be avoided
queries.add(new Query(57.154888, -2.101822, 57.153445, -2.099869, 329, 31));
// longer path should go through tertiary, see discussion in #476
queries.add(new Query(57.154888, -2.101822, 57.147299, -2.096286, 1118, 68));
Profile profile = new Profile("hike").setVehicle("hike").setWeighting("fastest");
GraphHopper hopper = createHopper(DIR + "/map-sidewalk-no.osm.gz", profile);
hopper.importOrLoad();
checkQueries(hopper, queries);
}
use of com.graphhopper.GraphHopper in project graphhopper by graphhopper.
the class RoutingAlgorithmWithOSMTest method testDisconnectedAreaAndMultiplePoints.
@Test
public void testDisconnectedAreaAndMultiplePoints() {
Query query = new Query();
query.add(53.753177, 9.435968, 10, 10);
query.add(53.751299, 9.386959, 10, 10);
query.add(53.751299, 9.3869, 10, 10);
GraphHopper hopper = createHopper(DIR + "/krautsand.osm.gz", new Profile("car").setVehicle("car").setWeighting("fastest"));
hopper.setElevationProvider(new SRTMProvider(DIR));
hopper.importOrLoad();
for (Function<Query, GHRequest> requestFactory : createRequestFactories()) {
GHRequest request = requestFactory.apply(query);
request.setProfile(hopper.getProfiles().get(0).getName());
GHResponse res = hopper.route(request);
assertTrue(res.hasErrors());
assertTrue(res.getErrors().toString().contains("ConnectionNotFound"), res.getErrors().toString());
}
}
Aggregations