GTn00b,
I think you'll find that the actual instance of
SimpleFeatureCollection returned by FeatureCollections.newCollection()
is a MemoryFeatureCollection, so it's not surprising the behavior has
not changed when you create a MemoryFeatureCollection directly. I'm
not recommending that you use MemoryFeatureCollection, since it orders
features by feature id, not by insertion order into the collection.
The LeanFeatureCollection maintains the insertion order of features,
but is unfortunately not yet part of the official GeoTools release.
-Larry
On Fri, Sep 17, 2010 at 2:51 AM, GTn00b <[email protected]> wrote:
>
> Thanks for your reply Larry.
>
>
> Larry Reeder wrote:
>>
>> If you're using MemoryFeatureCollection, it's backed by a TreeMap
>> which sorts by Feature Id.
>
> Using the CSV 2 SHP Lab as an example, on line 79 of
> http://svn.osgeo.org/geotools/trunk/demo/example/src/main/java/org/geotools/demo/Csv2Shape.java
> Csv2Shape.java I replace:
>
> SimpleFeatureCollection collection = FeatureCollections.newCollection();
>
> with
>
> MemoryFeatureCollection collection = new MemoryFeatureCollection(TYPE);
>
> This doesn't seem to make any difference to the ordering within the
> shapefile - Have I implemented this correctly? Should this work?
>
>
> Larry Reeder wrote:
>>
>> You could use LeanFeatureCollection as an alternative.
>
> I may give this a go later if I can't get MemoryFeatureCollection to work.
>
> Thanks.
>
>
>
> --
> View this message in context:
> http://osgeo-org.1803224.n2.nabble.com/Maintaining-line-order-when-creating-a-shapefile-tp5537984p5541910.html
> Sent from the geotools-gt2-users mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> Start uncovering the many advantages of virtual appliances
> and start using them to simplify application deployment and
> accelerate your shift to cloud computing.
> http://p.sf.net/sfu/novell-sfdev2dev
> _______________________________________________
> Geotools-gt2-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>
------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users