use of com.graphhopper.util.JsonFeatureCollection in project graphhopper by graphhopper.
the class IsochroneResourceTest method requestWithShortest.
@Test
public void requestWithShortest() {
Response rsp = clientTarget(app, "/isochrone").queryParam("profile", "short_car").queryParam("point", "42.509644,1.540554").queryParam("time_limit", 130).queryParam("buckets", 1).queryParam("type", "geojson").request().buildGet().invoke();
JsonFeatureCollection featureCollection = rsp.readEntity(JsonFeatureCollection.class);
assertEquals(1, featureCollection.getFeatures().size());
Geometry polygon0 = featureCollection.getFeatures().get(0).getGeometry();
assertIs2D(polygon0);
assertTrue(polygon0.contains(geometryFactory.createPoint(new Coordinate(1.527057, 42.507145))));
assertFalse(polygon0.contains(geometryFactory.createPoint(new Coordinate(1.525404, 42.507081))));
}
use of com.graphhopper.util.JsonFeatureCollection in project graphhopper by graphhopper.
the class IsochroneResourceTest method requestByTimeLimit.
@Test
public void requestByTimeLimit() {
Response rsp = clientTarget(app, "/isochrone").queryParam("profile", "fast_car").queryParam("point", "42.531073,1.573792").queryParam("time_limit", 5 * 60).queryParam("buckets", 2).queryParam("type", "geojson").request().buildGet().invoke();
JsonFeatureCollection featureCollection = rsp.readEntity(JsonFeatureCollection.class);
assertEquals(2, featureCollection.getFeatures().size());
Geometry polygon0 = featureCollection.getFeatures().get(0).getGeometry();
Geometry polygon1 = featureCollection.getFeatures().get(1).getGeometry();
assertTrue(polygon0.contains(geometryFactory.createPoint(new Coordinate(1.587224, 42.5386))));
assertFalse(polygon0.contains(geometryFactory.createPoint(new Coordinate(1.589756, 42.558012))));
assertTrue(polygon1.contains(geometryFactory.createPoint(new Coordinate(1.589756, 42.558012))));
assertFalse(polygon1.contains(geometryFactory.createPoint(new Coordinate(1.635246, 42.53841))));
}
Aggregations