Search in sources :

Example 1 with DWithin

use of org.opengis.filter.spatial.DWithin in project ddf by codice.

the class TestCswRecordMapperFilterVisitor method testVisitDWithin.

@Test
public void testVisitDWithin() {
    GeometryFactory geoFactory = new GeometryFactory();
    double val = 10;
    Expression pt1 = factory.literal(geoFactory.createPoint(new Coordinate(4, 5)));
    Expression pt2 = factory.literal(geoFactory.createPoint(new Coordinate(6, 7)));
    DWithin filter = factory.dwithin(pt1, pt2, val, "meters");
    DWithin duplicate = (DWithin) visitor.visit(filter, null);
    assertThat(duplicate.getExpression1(), is(pt1));
    assertThat(duplicate.getExpression2(), is(pt2));
    assertThat(duplicate.getDistanceUnits(), is(UomOgcMapping.METRE.name()));
    assertThat(duplicate.getDistance(), is(val));
}
Also used : GeometryFactory(com.vividsolutions.jts.geom.GeometryFactory) DWithin(org.opengis.filter.spatial.DWithin) Expression(org.opengis.filter.expression.Expression) Coordinate(com.vividsolutions.jts.geom.Coordinate) CswQueryFactoryTest(org.codice.ddf.spatial.ogc.csw.catalog.endpoint.CswQueryFactoryTest) Test(org.junit.Test)

Aggregations

Coordinate (com.vividsolutions.jts.geom.Coordinate)1 GeometryFactory (com.vividsolutions.jts.geom.GeometryFactory)1 CswQueryFactoryTest (org.codice.ddf.spatial.ogc.csw.catalog.endpoint.CswQueryFactoryTest)1 Test (org.junit.Test)1 Expression (org.opengis.filter.expression.Expression)1 DWithin (org.opengis.filter.spatial.DWithin)1