@Override public SimpleFeatureCollection subCollection(Filter filter) { SimpleFeatureCollection delegateCollection = delegate.subCollection(filter); return new ReTypingFeatureCollection(delegateCollection, target); }
public SimpleFeatureCollection subCollection(Filter filter) { return delegate.subCollection(filter); }
public SimpleFeatureCollection subCollection(Filter filter) { // reproject the filter to the delegate native crs CoordinateReferenceSystem crs = getSchema().getCoordinateReferenceSystem(); CoordinateReferenceSystem crsDelegate = delegate.getSchema().getCoordinateReferenceSystem(); if (crs != null) { DefaultCRSFilterVisitor defaulter = new DefaultCRSFilterVisitor(FF, crs); filter = (Filter) filter.accept(defaulter, null); if (crsDelegate != null && !CRS.equalsIgnoreMetadata(crs, crsDelegate)) { ReprojectingFilterVisitor reprojector = new ReprojectingFilterVisitor(FF, delegate.getSchema()); filter = (Filter) filter.accept(reprojector, null); } } SimpleFeatureCollection sub = delegate.subCollection(filter); if (sub != null) { try { ReprojectingFeatureCollection wrapper = new ReprojectingFeatureCollection(sub, target); wrapper.setDefaultSource(defaultSource); return wrapper; } catch (Exception e) { throw new RuntimeException(e); } } return null; }
public SimpleFeatureCollection subCollection(Filter filter) { SimpleFeatureCollection fColl = backendCollection.subCollection(filter); if (fColl == null) return null; return new PreGeneralizedFeatureCollection( fColl, featureType, indexMapping, geomPropertyName, backendGeomPropertyName); }
@Override public void accepts(FeatureVisitor visitor, ProgressListener progress) throws IOException { // the delegate might have an optimized way to handle filters and still apply a // visitor (e.g., ContentFeatureCollection), but avoid self-looping final SimpleFeatureCollection sc = delegate.subCollection(filter); if (sc instanceof FilteringSimpleFeatureCollection) { super.accepts(visitor, progress); } else { sc.accepts(visitor, progress); } }
private SimpleFeatureCollection filteredCollection( Geometry currentGeom, SimpleFeatureCollection subFeatureCollection) { FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2(null); Filter intersectFilter = ff.intersects(ff.property(dataGeomName), ff.literal(currentGeom)); SimpleFeatureCollection subFeatureCollectionIntersection = this.subFeatureCollection.subCollection(intersectFilter); if (subFeatureCollectionIntersection.size() == 0) { subFeatureCollectionIntersection = subFeatureCollection; } return subFeatureCollectionIntersection; } }
public void testSubSubCollection() { SimpleFeatureCollection sub = roads.subCollection(rd12Filter); SimpleFeatureCollection subsub = sub.subCollection(rd1Filter); assertEquals(1, subsub.size()); }
public boolean hasNext() { while (next == null && delegate.hasNext()) { SimpleFeature f = delegate.next(); for (Object attribute : f.getAttributes()) { if (attribute instanceof Geometry) { Geometry geom = (Geometry) attribute; Filter overFilter = ff.contains(ff.property(dataGeomName), ff.literal(geom)); SimpleFeatureCollection subFeatureCollectionInclusion = this.secondFeatures.subCollection(overFilter); if (subFeatureCollectionInclusion.size() > 0) { next = f; } } } } return next != null; }
public SimpleFeatureCollection subCollection(Filter filter) { return delegate.subCollection(filter); }
public SimpleFeatureCollection subCollection(Filter filter) { // reproject the filter to the delegate native crs CoordinateReferenceSystem crs = getSchema().getCoordinateReferenceSystem(); CoordinateReferenceSystem crsDelegate = delegate.getSchema().getCoordinateReferenceSystem(); if (crs != null) { DefaultCRSFilterVisitor defaulter = new DefaultCRSFilterVisitor(FF, crs); filter = (Filter) filter.accept(defaulter, null); if (crsDelegate != null && !CRS.equalsIgnoreMetadata(crs, crsDelegate)) { ReprojectingFilterVisitor reprojector = new ReprojectingFilterVisitor(FF, delegate.getSchema()); filter = (Filter) filter.accept(reprojector, null); } } return new ReprojectingFeatureCollection(delegate.subCollection(filter), target); }
public SimpleFeatureCollection subCollection(Filter filter) { SimpleFeatureCollection fColl = backendCollection .subCollection(filter); if (fColl == null) return null; return new PreGeneralizedFeatureCollection(fColl, featureType, indexMapping, geomPropertyName, backendGeomPropertyName); }
public void testSubCollection() throws Exception { FilterFactory ff = dataStore.getFilterFactory(); Filter f = ff.equals(ff.property(aname("intProperty")), ff.literal(1)); SimpleFeatureCollection sub = collection.subCollection(f); assertNotNull(sub); assertEquals(1, sub.size()); ReferencedEnvelope exp = new ReferencedEnvelope(1, 1, 1, 1, CRS.decode("EPSG:4326")); ReferencedEnvelope act = sub.getBounds(); assertEquals(exp.getMinX(), act.getMinX(), 0.1); assertEquals(exp.getMinY(), act.getMinY(), 0.1); assertEquals(exp.getMaxX(), act.getMaxX(), 0.1); assertEquals(exp.getMaxY(), act.getMaxY(), 0.1); }
return new ClippingFeatureCollection(features.subCollection(bboxFilter), clip, preserveZ);
@Override public boolean getCreateFeature(GridElement gridElement) { Filter filter = getIntersectsFilter(the_geom, gridElement.toGeometry()); return !featureSource.subCollection(filter).isEmpty(); } }
SimpleFeatureCollection zoneCollection = data.subCollection(areaFilter); Results stats = new AggregateProcess()
private SimpleFeatureCollection features; private ReferencedEnvelope env; private boolean isInShape(Point p) { if (!env.contains(p.getCoordinate())) { return false; } Expression propertyName = filterFactory.property(features.getSchema() .getGeometryDescriptor().getName()); Filter filter = filterFactory.contains(propertyName, filterFactory.literal(p)); SimpleFeatureCollection sub = features.subCollection(filter); if (sub.size() > 0) { return true; } return false; }
private SimpleFeatureCollection filteredCollection(Geometry currentGeom, SimpleFeatureCollection subFeatureCollection) { FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2(null); Filter intersectFilter = ff.intersects(ff.property(dataGeomName), ff.literal(currentGeom)); SimpleFeatureCollection subFeatureCollectionIntersection = this.subFeatureCollection .subCollection(intersectFilter); if (subFeatureCollectionIntersection.size() == 0) { subFeatureCollectionIntersection = subFeatureCollection; } return subFeatureCollectionIntersection; } }
public static SimpleFeatureCollection toSpatialIndexFeatureCollection( SimpleFeatureCollection features, ReferencedEnvelope bounds) { FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2(null); String geomName = features.getSchema().getGeometryDescriptor().getLocalName(); Filter filter = ff.bbox(ff.property(geomName), bounds); return toSpatialIndexFeatureCollection(features.subCollection(filter)); }
public SimpleFeatureCollection subCollection(Filter filter) { // reproject the filter to the delegate native crs CoordinateReferenceSystem crs = getSchema().getCoordinateReferenceSystem(); CoordinateReferenceSystem crsDelegate = delegate.getSchema().getCoordinateReferenceSystem(); if(crs != null) { DefaultCRSFilterVisitor defaulter = new DefaultCRSFilterVisitor(FF, crs); filter = (Filter) filter.accept(defaulter, null); if(crsDelegate != null && !CRS.equalsIgnoreMetadata(crs, crsDelegate)) { ReprojectingFilterVisitor reprojector = new ReprojectingFilterVisitor(FF, delegate.getSchema()); filter = (Filter) filter.accept(reprojector, null); } } return new ReprojectingFeatureCollection(delegate.subCollection(filter), target); }
@DescribeResult(name = "result", description = "Clipped feature collection") public SimpleFeatureCollection execute( @DescribeParameter(name = "features", description = "Input feature collection") SimpleFeatureCollection features, @DescribeParameter(name = "clip", description = "Geometry to use for clipping (in same CRS as input features)") Geometry clip) throws ProcessException { // only get the geometries in the bbox of the clip Envelope box = clip.getEnvelopeInternal(); FilterFactory ff = CommonFactoryFinder.getFilterFactory(null); String srs = null; if(features.getSchema().getCoordinateReferenceSystem() != null) { srs = CRS.toSRS(features.getSchema().getCoordinateReferenceSystem()); } BBOX bboxFilter = ff.bbox("", box.getMinX(), box.getMinY(), box.getMaxX(), box.getMaxY(), srs); // return dynamic collection clipping geometries on the fly return new ClippingFeatureCollection(features.subCollection(bboxFilter), clip); }