Attempting to use SpatialIndexFeatureCollection with some code like this:
SpatialIndexFeatureCollection spatial = new SpatialIndexFeatureCollection(schema);
spatial.add(featureBuilder.buildFeature(id)); SpatialIndexFeatureSource spatialSource = new SpatialIndexFeatureSource(spatial);
Point point = geoFactory.createPoint(new Coordinate(longitude, latitude));
if (spatialSource.getBounds().contains(point)) {
Filter f = ff.within(ff.literal(point), ff.property("geo"));
try (SimpleFeatureIterator i = spatialSource.getFeatures(filter).features()) {
if (i.hasNext()) {
}
}
}
blows up with the following exception during the call to spatialSource.getFeatures(filter):
Is this the correct way to use this component? If not, can an example be provided with how it's supposed to be used?
|