Search in sources :

Example 1 with SpatialIndex

use of org.apache.jena.geosparql.spatial.SpatialIndex in project jena by apache.

the class WestPFTest method testCheckSearchEnvelope_wrap.

/**
 * Test of checkSearchEnvelope method, of class WestPF.
 */
@Test
public void testCheckSearchEnvelope_wrap() {
    SpatialIndex spatialIndex = SpatialIndexTestData.createTestIndex();
    // Search Envelope
    GeometryWrapper geometryWrapper = SpatialIndexTestData.HONOLULU_GEOMETRY_WRAPPER;
    WestPF instance = new WestPF();
    // Needed to initialise the search.
    SearchEnvelope searchEnvelope = instance.buildSearchEnvelope(geometryWrapper, SpatialIndexTestData.WGS_84_SRS_INFO);
    HashSet<Resource> expResult = new HashSet<>(Arrays.asList(SpatialIndexTestData.AUCKLAND_FEATURE, SpatialIndexTestData.PERTH_FEATURE, SpatialIndexTestData.HONOLULU_FEATURE));
    HashSet<Resource> result = searchEnvelope.check(spatialIndex);
    assertEquals(expResult, result);
}
Also used : SpatialIndex(org.apache.jena.geosparql.spatial.SpatialIndex) GeometryWrapper(org.apache.jena.geosparql.implementation.GeometryWrapper) Resource(org.apache.jena.rdf.model.Resource) SearchEnvelope(org.apache.jena.geosparql.spatial.SearchEnvelope) HashSet(java.util.HashSet) Test(org.junit.Test)

Example 2 with SpatialIndex

use of org.apache.jena.geosparql.spatial.SpatialIndex in project jena by apache.

the class WestPFTest method testCheckSearchEnvelope_no_wrap.

/**
 * Test of checkSearchEnvelope method, of class WestPF.
 */
@Test
public void testCheckSearchEnvelope_no_wrap() {
    SpatialIndex spatialIndex = SpatialIndexTestData.createTestIndex();
    // Search Envelope
    GeometryWrapper geometryWrapper = SpatialIndexTestData.PERTH_GEOMETRY_WRAPPER;
    WestPF instance = new WestPF();
    // Needed to initialise the search.
    SearchEnvelope searchEnvelope = instance.buildSearchEnvelope(geometryWrapper, SpatialIndexTestData.WGS_84_SRS_INFO);
    HashSet<Resource> expResult = new HashSet<>(Arrays.asList(SpatialIndexTestData.LONDON_FEATURE, SpatialIndexTestData.PERTH_FEATURE));
    HashSet<Resource> result = searchEnvelope.check(spatialIndex);
    assertEquals(expResult, result);
}
Also used : SpatialIndex(org.apache.jena.geosparql.spatial.SpatialIndex) GeometryWrapper(org.apache.jena.geosparql.implementation.GeometryWrapper) Resource(org.apache.jena.rdf.model.Resource) SearchEnvelope(org.apache.jena.geosparql.spatial.SearchEnvelope) HashSet(java.util.HashSet) Test(org.junit.Test)

Example 3 with SpatialIndex

use of org.apache.jena.geosparql.spatial.SpatialIndex in project jena by apache.

the class EastPFTest method testCheckSearchEnvelope_no_wrap.

/**
 * Test of checkSearchEnvelope method, of class EastPF.
 */
@Test
public void testCheckSearchEnvelope_no_wrap() {
    SpatialIndex spatialIndex = SpatialIndexTestData.createTestIndex();
    // Search Envelope
    GeometryWrapper geometryWrapper = SpatialIndexTestData.HONOLULU_GEOMETRY_WRAPPER;
    EastPF instance = new EastPF();
    // Needed to initialise the search.
    SearchEnvelope searchEnvelope = instance.buildSearchEnvelope(geometryWrapper, SpatialIndexTestData.WGS_84_SRS_INFO);
    HashSet<Resource> expResult = new HashSet<>(Arrays.asList(SpatialIndexTestData.LONDON_FEATURE, SpatialIndexTestData.HONOLULU_FEATURE, SpatialIndexTestData.NEW_YORK_FEATURE));
    HashSet<Resource> result = searchEnvelope.check(spatialIndex);
    assertEquals(expResult, result);
}
Also used : SpatialIndex(org.apache.jena.geosparql.spatial.SpatialIndex) GeometryWrapper(org.apache.jena.geosparql.implementation.GeometryWrapper) Resource(org.apache.jena.rdf.model.Resource) SearchEnvelope(org.apache.jena.geosparql.spatial.SearchEnvelope) HashSet(java.util.HashSet) Test(org.junit.Test)

Example 4 with SpatialIndex

use of org.apache.jena.geosparql.spatial.SpatialIndex in project jena by apache.

the class EastPFTest method testCheckSearchEnvelope_wrap.

/**
 * Test of checkSearchEnvelope method, of class EastPF.
 */
@Test
public void testCheckSearchEnvelope_wrap() {
    SpatialIndex spatialIndex = SpatialIndexTestData.createTestIndex();
    // Search Envelope
    GeometryWrapper geometryWrapper = SpatialIndexTestData.PERTH_GEOMETRY_WRAPPER;
    EastPF instance = new EastPF();
    // Needed to initialise the search.
    SearchEnvelope searchEnvelope = instance.buildSearchEnvelope(geometryWrapper, SpatialIndexTestData.WGS_84_SRS_INFO);
    HashSet<Resource> expResult = new HashSet<>(Arrays.asList(SpatialIndexTestData.AUCKLAND_FEATURE, SpatialIndexTestData.PERTH_FEATURE, SpatialIndexTestData.HONOLULU_FEATURE, SpatialIndexTestData.NEW_YORK_FEATURE));
    HashSet<Resource> result = searchEnvelope.check(spatialIndex);
    assertEquals(expResult, result);
}
Also used : SpatialIndex(org.apache.jena.geosparql.spatial.SpatialIndex) GeometryWrapper(org.apache.jena.geosparql.implementation.GeometryWrapper) Resource(org.apache.jena.rdf.model.Resource) SearchEnvelope(org.apache.jena.geosparql.spatial.SearchEnvelope) HashSet(java.util.HashSet) Test(org.junit.Test)

Example 5 with SpatialIndex

use of org.apache.jena.geosparql.spatial.SpatialIndex in project jena by apache.

the class WestGeomPFTest method testCheckSearchEnvelope_wrap.

/**
 * Test of checkSearchEnvelope method, of class WestGeomPF.
 */
@Test
public void testCheckSearchEnvelope_wrap() {
    SpatialIndex spatialIndex = SpatialIndexTestData.createTestIndex();
    // Search Envelope
    GeometryWrapper geometryWrapper = SpatialIndexTestData.HONOLULU_GEOMETRY_WRAPPER;
    WestGeomPF instance = new WestGeomPF();
    // Needed to initialise the search.
    SearchEnvelope searchEnvelope = instance.buildSearchEnvelope(geometryWrapper, SpatialIndexTestData.WGS_84_SRS_INFO);
    HashSet<Resource> expResult = new HashSet<>(Arrays.asList(SpatialIndexTestData.AUCKLAND_FEATURE, SpatialIndexTestData.PERTH_FEATURE, SpatialIndexTestData.HONOLULU_FEATURE));
    HashSet<Resource> result = searchEnvelope.check(spatialIndex);
    assertEquals(expResult, result);
}
Also used : SpatialIndex(org.apache.jena.geosparql.spatial.SpatialIndex) GeometryWrapper(org.apache.jena.geosparql.implementation.GeometryWrapper) Resource(org.apache.jena.rdf.model.Resource) SearchEnvelope(org.apache.jena.geosparql.spatial.SearchEnvelope) HashSet(java.util.HashSet) Test(org.junit.Test)

Aggregations

GeometryWrapper (org.apache.jena.geosparql.implementation.GeometryWrapper)9 SpatialIndex (org.apache.jena.geosparql.spatial.SpatialIndex)9 Resource (org.apache.jena.rdf.model.Resource)9 HashSet (java.util.HashSet)8 SearchEnvelope (org.apache.jena.geosparql.spatial.SearchEnvelope)8 Test (org.junit.Test)8 SpatialIndexException (org.apache.jena.geosparql.spatial.SpatialIndexException)1 Node (org.apache.jena.graph.Node)1 Triple (org.apache.jena.graph.Triple)1 Var (org.apache.jena.sparql.core.Var)1 QueryIterator (org.apache.jena.sparql.engine.QueryIterator)1 Binding (org.apache.jena.sparql.engine.binding.Binding)1 QueryIterConcat (org.apache.jena.sparql.engine.iterator.QueryIterConcat)1 ExprEvalException (org.apache.jena.sparql.expr.ExprEvalException)1 Envelope (org.locationtech.jts.geom.Envelope)1 MismatchedDimensionException (org.opengis.geometry.MismatchedDimensionException)1 TransformException (org.opengis.referencing.operation.TransformException)1 FactoryException (org.opengis.util.FactoryException)1