final ReferencedEnvelope envelope = c.getBounds(); if (envelope == null) { return DataUtilities.bounds(c);
/** * Retreives the bounds for a feature source. * * <p>If the feautre source can calculate the bounds directly, those bounds are returned. * Otherwise, the underlying feature collection is retreived and asked to calculate bounds. If * that fails, an empty envelope is returned. * * @param fs The feature source. * @return The bounds. * @throws IOException Execption calculating bounds on feature source. */ public static ReferencedEnvelope getBoundingBoxEnvelope( FeatureSource<? extends FeatureType, ? extends Feature> fs) throws IOException { ReferencedEnvelope ev = fs.getBounds(); if ((ev == null) || ev.isNull()) { try { ev = fs.getFeatures().getBounds(); } catch (Throwable t) { LOGGER.log( Level.FINE, "Could not compute the data bounding box. Returning an empty envelope", t); ev = new ReferencedEnvelope(fs.getSchema().getCoordinateReferenceSystem()); } } return ev; } }
@Override public ReferencedEnvelope getBounds(Query query) throws IOException { return features.getBounds(); }
@Override public ReferencedEnvelope getBounds() throws IOException { return features.getBounds(); }
public ReferencedEnvelope getBounds() { return delegate.getBounds(); }
public ReferencedEnvelope getBounds() { return collection.getBounds(); }
/** @see org.geotools.data.FeatureResults#getBounds() */ public ReferencedEnvelope getBounds() { ReferencedEnvelope env = results.getBounds(); if (env == null) { return null; } env = new ReferencedEnvelope(env, getSchema().getCoordinateReferenceSystem()); return env; }
/** * Prints up the gml for a featurecollection. * * @param collection FeatureCollection being encoded */ public void handleFeatureCollection(FeatureCollection<?, ?> collection) { startFeatureCollection(); if (collectionBounding) writeBounds(collection.getBounds()); }
@DescribeResult(name = "bounds", description = "Bounding box of input features") public ReferencedEnvelope execute( @DescribeParameter(name = "features", description = "Input feature collection") FeatureCollection features) { return features.getBounds(); } }
final ReferencedEnvelope bounds = features.getBounds(); final CoordinateReferenceSystem crs = bounds != null ? bounds.getCoordinateReferenceSystem() : null;
ReferencedEnvelope bounds = null; for (int i = 0; i < results.length; i++) { ReferencedEnvelope more = results[i].getBounds(); if (bounds == null) { bounds = new ReferencedEnvelope(more);
return wrapped.getBounds();
/** * @see org.geotools.data.FeatureResults#getBounds() */ public ReferencedEnvelope getBounds() { return ReferencedEnvelope.reference( results.getBounds() ); }
public void testFeatureCollection() throws Exception { FeatureSource fs = dataStore.getFeatureSource(tname("empty")); FeatureCollection features = fs.getFeatures(); assertTrue(features.getBounds().isNull()); assertEquals(0, features.size()); try (FeatureIterator i = features.features()) { assertFalse(i.hasNext()); } } }
/** * @see org.geotools.data.FeatureResults#getBounds() */ public ReferencedEnvelope getBounds() { ReferencedEnvelope env = results.getBounds(); if(env == null) { return null; } env = new ReferencedEnvelope(env, getSchema().getCoordinateReferenceSystem()); return env; }
/** * Prints up the gml for a featurecollection. * * @param collection DOCUMENT ME! */ public void handleFeatureCollection(FeatureCollection collection) { startFeatureCollection(); writeBounds(collection.getBounds()); }
/** * Prints up the gml for a featurecollection. * * @param collection FeatureCollection being encoded */ public void handleFeatureCollection(FeatureCollection<?,?> collection) { startFeatureCollection(); if(collectionBounding) writeBounds(collection.getBounds()); }
@DescribeResult(name = "bounds", description = "Bounding box of input features") public ReferencedEnvelope execute( @DescribeParameter(name = "features", description = "Input feature collection") FeatureCollection features) { return features.getBounds(); }
public void testGetFeatureSourceRiver() throws NoSuchElementException, IOException, IllegalAttributeException { FeatureSource river = data.getFeatureSource("RIVER"); assertEquals(riverType, river.getSchema()); assertEquals(data, river.getDataStore()); FeatureCollection all = river.getFeatures(); assertEquals(2, all.size()); assertEquals(riverBounds, all.getBounds()); assertTrue("RIVERS", covers(all.features(), riverFeatures)); FeatureCollection expected = DataUtilities.collection(riverFeatures); assertCovers("ALL", expected, all); assertEquals(riverBounds, all.getBounds()); }