Search in sources :

Example 1 with PolygonSpatialFilter

use of org.codice.ddf.opensearch.query.filter.PolygonSpatialFilter in project ddf by codice.

the class OpenSearchQuery method addPolygonSpatialFilter.

public void addPolygonSpatialFilter(String polygon) {
    PolygonSpatialFilter polygonFilter = new PolygonSpatialFilter(polygon);
    addSpatialFilter(polygonFilter);
}
Also used : PolygonSpatialFilter(org.codice.ddf.opensearch.query.filter.PolygonSpatialFilter)

Example 2 with PolygonSpatialFilter

use of org.codice.ddf.opensearch.query.filter.PolygonSpatialFilter in project ddf by codice.

the class OpenSearchQueryTest method testPolygonSpatialFilterWktConversion.

@Test
public void testPolygonSpatialFilterWktConversion() throws Exception {
    // WKT is lon/lat, polygon is lat/lon
    String expectedGeometryWkt = "POLYGON((10 0,30 0,30 20,10 20,10 0))";
    String latLon = "0,10,0,30,20,30,20,10,0,10";
    PolygonSpatialFilter term = new PolygonSpatialFilter(latLon);
    String geometryWkt = term.getGeometryWkt();
    LOGGER.debug("geometryWkt = {}", geometryWkt);
    assertEquals(expectedGeometryWkt, geometryWkt);
}
Also used : PolygonSpatialFilter(org.codice.ddf.opensearch.query.filter.PolygonSpatialFilter) Test(org.junit.Test)

Aggregations

PolygonSpatialFilter (org.codice.ddf.opensearch.query.filter.PolygonSpatialFilter)2 Test (org.junit.Test)1