|
|
|
svn_geotools
|
Author: aaime
Date: 2009-11-03 06:26:28 -0500 (Tue, 03 Nov 2009) New Revision: 34311 Modified: branches/2.6.x/modules/plugin/shapefile/ branches/2.6.x/modules/plugin/shapefile/src/main/java/org/geotools/data/shapefile/ShapefileAttributeReader.java branches/2.6.x/modules/plugin/shapefile/src/main/java/org/geotools/data/shapefile/ShapefileDataStore.java branches/2.6.x/modules/plugin/shapefile/src/main/java/org/geotools/data/shapefile/dbf/DbaseFileReader.java branches/2.6.x/modules/plugin/shapefile/src/main/java/org/geotools/data/shapefile/indexed/IndexedShapefileDataStore.java branches/2.6.x/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 Property changes on: branches/2.6.x/modules/plugin/shapefile ___________________________________________________________________ Modified: svn:mergeinfo - /branches/2.5.x/modules/plugin/shapefile:33331,33337-33338,33349,33351,33354,33601,33614,33682,33788 /trunk/modules/plugin/shapefile:34241,34255,34258 + /branches/2.5.x/modules/plugin/shapefile:33331,33337-33338,33349,33351,33354,33601,33614,33682,33788 /trunk/modules/plugin/shapefile:34241,34255,34258,34309-34310 Modified: branches/2.6.x/modules/plugin/shapefile/src/main/java/org/geotools/data/shapefile/ShapefileAttributeReader.java =================================================================== --- branches/2.6.x/modules/plugin/shapefile/src/main/java/org/geotools/data/shapefile/ShapefileAttributeReader.java 2009-11-03 11:18:59 UTC (rev 34310) +++ branches/2.6.x/modules/plugin/shapefile/src/main/java/org/geotools/data/shapefile/ShapefileAttributeReader.java 2009-11-03 11:26:28 UTC (rev 34311) @@ -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: branches/2.6.x/modules/plugin/shapefile/src/main/java/org/geotools/data/shapefile/ShapefileDataStore.java =================================================================== --- branches/2.6.x/modules/plugin/shapefile/src/main/java/org/geotools/data/shapefile/ShapefileDataStore.java 2009-11-03 11:18:59 UTC (rev 34310) +++ branches/2.6.x/modules/plugin/shapefile/src/main/java/org/geotools/data/shapefile/ShapefileDataStore.java 2009-11-03 11:26:28 UTC (rev 34311) @@ -349,7 +349,7 @@ // gather attributes needed by the query tool, they will be used by the // query filter - FilterAttributeExtractor extractor = new FilterAttributeExtractor(); + FilterAttributeExtractor extractor = new FilterAttributeExtractor(schema); Filter filter = query.getFilter(); filter.accept(extractor, null); String[] filterAttnames = extractor.getAttributeNames(); Modified: branches/2.6.x/modules/plugin/shapefile/src/main/java/org/geotools/data/shapefile/dbf/DbaseFileReader.java =================================================================== --- branches/2.6.x/modules/plugin/shapefile/src/main/java/org/geotools/data/shapefile/dbf/DbaseFileReader.java 2009-11-03 11:18:59 UTC (rev 34310) +++ branches/2.6.x/modules/plugin/shapefile/src/main/java/org/geotools/data/shapefile/dbf/DbaseFileReader.java 2009-11-03 11:26:28 UTC (rev 34311) @@ -307,6 +307,7 @@ foundRecord = true; } } + cnt++; } /** Modified: branches/2.6.x/modules/plugin/shapefile/src/main/java/org/geotools/data/shapefile/indexed/IndexedShapefileDataStore.java =================================================================== --- branches/2.6.x/modules/plugin/shapefile/src/main/java/org/geotools/data/shapefile/indexed/IndexedShapefileDataStore.java 2009-11-03 11:18:59 UTC (rev 34310) +++ branches/2.6.x/modules/plugin/shapefile/src/main/java/org/geotools/data/shapefile/indexed/IndexedShapefileDataStore.java 2009-11-03 11:26:28 UTC (rev 34311) @@ -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: branches/2.6.x/modules/plugin/shapefile/src/test/java/org/geotools/data/shapefile/indexed/IndexedShapefileDataStoreTest.java =================================================================== --- branches/2.6.x/modules/plugin/shapefile/src/test/java/org/geotools/data/shapefile/indexed/IndexedShapefileDataStoreTest.java 2009-11-03 11:18:59 UTC (rev 34310) +++ branches/2.6.x/modules/plugin/shapefile/src/test/java/org/geotools/data/shapefile/indexed/IndexedShapefileDataStoreTest.java 2009-11-03 11:26:28 UTC (rev 34311) @@ -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 |
||||||||||||||||
| Free Embeddable Forum Powered by Nabble | Help |