IndexedShapefileReader not being ReTyped

1 message Options
Embed this post
Permalink
Jody Garnett-2

IndexedShapefileReader not being ReTyped

Reply Threaded More More options
Print post
Permalink
Emily I am taking this to the GeoTools list...

In tracing through it looks like IndexShapefileAttributeReader is not  
being wrapped up in a ReType ... I suspect it wants to do everything  
itself for speed?

So two solutions:
- layer ReTypeFeatureReader around IndexedShapefileAttributeReader; or
- The FDFeatureReader ends up calling read( 0 ); and the  
ShapeFileAttributeReader has a hard coded check so that 0 always  
returns the geometry.

Jody

Notes taken while debugging
----------------------------------------------------------
FeatureReaderIterator - > FIDFeatureReader ->  
IndexedShapefileAttributeReader

With IndexedShapefileAttributeReader holding on to:
- IndexedDbaseFileReader
- ShapefileReader


Compare with ....

FeatureReaderIterator -> ReTypeFeatureReader -> FilteringFeatureReader  
-> FIDFeatureReader -> ShapefileAttributeReader

WIth FIDFeatureReader holding on to:
- DefaultFIDReader
- ShapefileAttributeReader
-- DbaseFileReader
-- ShapefileReader

  implement IndexedShapefileAttributeReader.read( int param ) with  
more logic so case 0 is not always geometry

The current implementation of ShapefileAttributeReader.read is as  
follows:

     public Object read(int param) throws IOException,
             java.lang.ArrayIndexOutOfBoundsException {
         switch (param) {
         case 0:
             return geometry;

         default:
             if (row != null) {
                 return row.read(dbfindexes[param]);
             }
             return null;
       }

IndexedShapefileDataStore creates one of readers and has the complete  
query to pass in.

Jody


> I managed to put together a test case which reproduces this bug,  
> however I
> have no idea how to fix it or even where to look.  I've reported a  
> bug here:
> http://jira.codehaus.org/browse/GEOT-2782
>
> The IndexedShapefileDataStore seems to produce the problem, however  
> the
> ShapefileDataStore seems to work okay.
>
> Emily

------------------------------------------------------------------------------
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-gt2-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users