Author: aaime
Date: 2009-11-03 06:14:48 -0500 (Tue, 03 Nov 2009)
New Revision: 34309
Modified:
trunk/modules/plugin/shapefile/src/main/java/org/geotools/data/shapefile/ShapefileAttributeReader.java
trunk/modules/plugin/shapefile/src/main/java/org/geotools/data/shapefile/dbf/DbaseFileReader.java
trunk/modules/plugin/shapefile/src/main/java/org/geotools/data/shapefile/indexed/IndexedShapefileDataStore.java
trunk/modules/plugin/shapefile/src/test/java/org/geotools/data/shapefile/indexed/IndexedShapefileDataStoreTest.java
Log:
GEOT-2821, Indexed shapefile datastore does not process correctly geometry filters against the default geometry associated with no geometry property extraction
Modified: trunk/modules/plugin/shapefile/src/main/java/org/geotools/data/shapefile/ShapefileAttributeReader.java
===================================================================
--- trunk/modules/plugin/shapefile/src/main/java/org/geotools/data/shapefile/ShapefileAttributeReader.java 2009-11-03 10:08:21 UTC (rev 34308)
+++ trunk/modules/plugin/shapefile/src/main/java/org/geotools/data/shapefile/ShapefileAttributeReader.java 2009-11-03 11:14:48 UTC (rev 34309)
@@ -23,13 +23,10 @@
import org.geotools.data.AttributeReader;
import org.geotools.data.shapefile.dbf.DbaseFileHeader;
import org.geotools.data.shapefile.dbf.DbaseFileReader;
-import org.geotools.data.shapefile.shp.ShapeType;
import org.geotools.data.shapefile.shp.ShapefileReader;
-import org.geotools.data.shapefile.shp.ShapefileReader.Record;
import org.opengis.feature.type.AttributeDescriptor;
import com.vividsolutions.jts.geom.Envelope;
-import com.vividsolutions.jts.geom.GeometryFactory;
/**
* An AttributeReader implementation for Shapefile. Pretty straightforward.
Modified: trunk/modules/plugin/shapefile/src/main/java/org/geotools/data/shapefile/dbf/DbaseFileReader.java
===================================================================
--- trunk/modules/plugin/shapefile/src/main/java/org/geotools/data/shapefile/dbf/DbaseFileReader.java 2009-11-03 10:08:21 UTC (rev 34308)
+++ trunk/modules/plugin/shapefile/src/main/java/org/geotools/data/shapefile/dbf/DbaseFileReader.java 2009-11-03 11:14:48 UTC (rev 34309)
@@ -307,6 +307,7 @@
foundRecord = true;
}
}
+ cnt++;
}
/**
Modified: trunk/modules/plugin/shapefile/src/main/java/org/geotools/data/shapefile/indexed/IndexedShapefileDataStore.java
===================================================================
--- trunk/modules/plugin/shapefile/src/main/java/org/geotools/data/shapefile/indexed/IndexedShapefileDataStore.java 2009-11-03 10:08:21 UTC (rev 34308)
+++ trunk/modules/plugin/shapefile/src/main/java/org/geotools/data/shapefile/indexed/IndexedShapefileDataStore.java 2009-11-03 11:14:48 UTC (rev 34309)
@@ -290,7 +290,7 @@
// add the attributes we need to read to keep the filtering going
if(propertyNames.length > 0) {
- FilterAttributeExtractor fae = new FilterAttributeExtractor();
+ FilterAttributeExtractor fae = new FilterAttributeExtractor(schema);
query.getFilter().accept(fae, null);
Set<String> attributes = new LinkedHashSet<String>(Arrays.asList(propertyNames));
Modified: trunk/modules/plugin/shapefile/src/test/java/org/geotools/data/shapefile/indexed/IndexedShapefileDataStoreTest.java
===================================================================
--- trunk/modules/plugin/shapefile/src/test/java/org/geotools/data/shapefile/indexed/IndexedShapefileDataStoreTest.java 2009-11-03 10:08:21 UTC (rev 34308)
+++ trunk/modules/plugin/shapefile/src/test/java/org/geotools/data/shapefile/indexed/IndexedShapefileDataStoreTest.java 2009-11-03 11:14:48 UTC (rev 34309)
@@ -356,6 +356,26 @@
assertNotNull( "selection query worked", features );
assertTrue( "selection non empty", features.size() > 0 );
}
+
+ public void testQueryBboxNonGeomAttributes() throws Exception {
+ File shpFile = copyShapefiles(STATE_POP);
+ URL url = shpFile.toURI().toURL();
+ IndexedShapefileDataStore ds = new IndexedShapefileDataStore(url, null, true, true,
+ IndexType.NONE);
+ FeatureSource<SimpleFeatureType, SimpleFeature> fs = ds.getFeatureSource();
+
+ // build a query that extracts no geom but uses a bbox filter
+ FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2(null);
+ DefaultQuery q = new DefaultQuery();
+ q.setPropertyNames(new String[] {"STATE_NAME", "PERSONS"});
+ ReferencedEnvelope queryBounds = new ReferencedEnvelope(-75.102613, -72.361859, 40.212597,
+ 41.512517, null);
+ q.setFilter(ff.bbox(ff.property(""), queryBounds));
+
+ // grab the features
+ FeatureCollection<SimpleFeatureType, SimpleFeature> fc = fs.getFeatures(q);
+ assertTrue(fc.size() > 0);
+ }
public void testFidFilter() throws Exception {
File shpFile = copyShapefiles(STATE_POP);
------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference_______________________________________________
GeoTools-commits mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geotools-commits