Gertjan van Oosten ha scritto:
> 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!

No, that's the officially supported way (more or less, as you've seen).
What I meant is that I try to use the least features I can out of
FeatureCollection, that's all.
The problem with using them by "instinct" is that your instinct is
trained on memory based collections (ArrayList and friends) and these
are persistent, and manage scarce resources (database connection, file
descriptors) so your usual instincts may trick you.

>> 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();

Yeah, I always use FeatureIterator me too if possible. Yet, the day
you pass your collection to a java.util.Collection based algorithm
that bails out of the iteration mid way (for loop and break)
you'll get a nicely lost connection, or whatever is the resource the 
collection is based on. Sigh...

Cheers
Andrea


-------------------------------------------------------------------------
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

Reply via email to