Skip to end of metadata
Go to start of metadata
Icon

This page is out of date - please see:

Given an area of interest stored as an envelope the following code will limit the features returned to those which are not wholy outside the bounding box.

Of course you may still wonder where "road" comes from - that is the name of the geometry attribute.

This code fetches the default geometry for a typeName.

FeatureType featureType = dataStore.getSchema( typeName );
String geometryName = featureType.getDefaultGeomety().getName();

Note that this may or may not still lead to the datastore reading all of the filters in, for example a shapefile reader will still need to examine all the features to determine which to return. However an SQL based datastore will convert the filter into part of the SQL query which will be much faster.

In GeoTools 2.2, IndexedShapefile is available that will optmize BBOX filters

  • No labels