Search in sources :

Example 6 with GeoResult

use of org.codice.ddf.spatial.geocoder.GeoResult in project ddf by codice.

the class TestGeoNamesLocalIndex method testWithResults.

@Test
public void testWithResults() throws GeoEntryQueryException {
    final List<GeoEntry> topResults = Arrays.asList(GEO_ENTRY_1, GEO_ENTRY_2);
    doReturn(topResults).when(geoEntryQueryable).query("Phoenix", 1);
    final GeoResult geoResult = geoNamesLocalIndex.getLocation("Phoenix");
    assertThat(geoResult.getFullName(), is(equalTo(GEO_ENTRY_1.getName())));
    final Point point = new PointImpl(new DirectPositionImpl(GEO_ENTRY_1.getLongitude(), GEO_ENTRY_1.getLatitude()));
    assertThat(geoResult.getPoint(), is(equalTo(point)));
}
Also used : DirectPositionImpl(org.geotools.geometry.jts.spatialschema.geometry.DirectPositionImpl) GeoEntry(org.codice.ddf.spatial.geocoding.GeoEntry) GeoResult(org.codice.ddf.spatial.geocoder.GeoResult) Point(org.opengis.geometry.primitive.Point) PointImpl(org.geotools.geometry.jts.spatialschema.geometry.primitive.PointImpl) Test(org.junit.Test)

Aggregations

GeoResult (org.codice.ddf.spatial.geocoder.GeoResult)6 Test (org.junit.Test)4 JSONArray (net.minidev.json.JSONArray)2 JSONObject (net.minidev.json.JSONObject)2 GeoCoder (org.codice.ddf.spatial.geocoder.GeoCoder)2 GeoEntry (org.codice.ddf.spatial.geocoding.GeoEntry)2 DirectPositionImpl (org.geotools.geometry.jts.spatialschema.geometry.DirectPositionImpl)1 PointImpl (org.geotools.geometry.jts.spatialschema.geometry.primitive.PointImpl)1 Matchers.anyString (org.mockito.Matchers.anyString)1 Point (org.opengis.geometry.primitive.Point)1