use of com.graphhopper.api.model.GHGeocodingResponse in project graphhopper by graphhopper.
the class GraphHopperGeocodingIT method testReverseGeocoding.
@Test
public void testReverseGeocoding() {
GHGeocodingResponse response = geocoding.geocode(new GHGeocodingRequest(52.5170365, 13.3888599, "en", 5));
assertEquals(5, response.getHits().size());
GHGeocodingEntry entry = response.getHits().get(0);
assertTrue(entry.getName().contains("Berlin"));
assertEquals("place", entry.getOsmKey());
assertEquals(0, entry.getExtent().length);
}
use of com.graphhopper.api.model.GHGeocodingResponse in project graphhopper by graphhopper.
the class GraphHopperGeocodingIT method testExtent.
@Test
public void testExtent() {
GHGeocodingResponse response = geocoding.geocode(new GHGeocodingRequest("new york", "en", 7));
BBox extent = response.getHits().get(0).getExtendBBox();
assertTrue(extent.isValid());
assertTrue(extent.minLon < -79);
assertTrue(extent.maxLon > -72);
assertTrue(extent.minLat < 40.5);
assertTrue(extent.maxLat > 45);
}
use of com.graphhopper.api.model.GHGeocodingResponse in project graphhopper by graphhopper.
the class GraphHopperGeocodingIT method testForwardGeocoding.
@Test
public void testForwardGeocoding() {
GHGeocodingResponse response = geocoding.geocode(new GHGeocodingRequest("Berlin", "en", 7));
assertEquals(7, response.getHits().size());
assertTrue(response.getHits().get(0).getName().contains("Berlin"));
}
use of com.graphhopper.api.model.GHGeocodingResponse in project graphhopper by graphhopper.
the class GraphHopperGeocodingIT method testForwardGeocodingNominatim.
@Test
public void testForwardGeocodingNominatim() {
GHGeocodingResponse response = geocoding.geocode(new GHGeocodingRequest(false, null, "Berlin", "en", 5, "nominatim", 5000));
assertEquals(5, response.getHits().size());
assertTrue(response.getHits().get(0).getName().contains("Berlin"));
}
Aggregations