Hi Gertjan, Andrea is correct when he states that FeatureCollection is an inconsistent entity in geotools. To be quite honest with you it is a complete mess.
The *only* part of the FeatureCollection api that is actually implemented relativley consistently is the iterator part of it. This is sad but I do not recommend relying on any parts of the api. If you need to do something you are better off doing it through the Query api. -Justin Gertjan van Oosten wrote: > As quoted from Andrea Aime <[EMAIL PROTECTED]>: >> FeatureCollection is one of those topics where geotools developers >> are not agreeing with each other, as such is not evenly covered usage >> wise (which also mean QA wise). I personally don't like them, and >> don't rely on them more than as a glorified FeatureReader. > > But the API for FeatureCollection seems very convenient. At least, to > me who's just starting programming on GeoTools. Since many of the > examples I found on the GeoTools sites (both docs.codehaus.org and > geotools.codehaus.org) are out of date, use deprecated classes and/or > don't even compile, I'm going by instinct, the API docs and > http://geotools.codehaus.org/Upgrade+to+2.4 . If there's a better way > to access features in my datastore, I'd like to learn about it! > >> Geoserver uses feature sorting, so it works, but only if you specify >> it in the Query apparently? Can you open a Jira issue for this? > > Will do. > >> Oh, btw, you are closing each iterator you get out of the collection >> using collection.close(iterator), right? :) > > Well, actually I was using: > > final FeatureIterator iter = features.features(); > while (iter.hasNext()) { > // ... > } > iter.close(); > > since I like that better style-wise than the fragment that's in the API > docs at > http://javadoc.geotools.fr/2.4/org/geotools/feature/FeatureCollection.html > > Kind regards, -- Justin Deoliveira The Open Planning Project http://topp.openplans.org ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ Geotools-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/geotools-devel
