There are several FeatureCollection implementations for different purposes.
The DefaultFeatureCollection implementation is built around a TreeMap and
sorts the contents by FeatureId.

See the docs for alternatives:
-
http://docs.geotools.org/latest/userguide/library/main/collection.html#performance-options

Jody Garnett

On Wed, Sep 24, 2014 at 12:24 PM, electrotype <electrot...@gmail.com> wrote:

> I use org.geotools.xml.Parser#parse(...) to parse a GML based XML file.
> This XML contains a
> <gml:FeatureCollection> which contains multiple <gml:featureMember>.
>
> The problem is that the resulting DefaultFeatureCollection doesn't seem to
> keep the order in which
> the featureMembers are declared.
>
> For example,
>
> ----------------------
> Iterator<SimpleFeature> iterator = defaultFeatureCollection.iterator();
> ----------------------
>
> ... returns an Iterator with the elements in another order. I think
> DefaultFeatureCollection uses a
> TreeMap to keep the elements, but sort them by internal ID, not by the
> order they appear in the XML.
>
> Our application would require the order of the featureMembers to be
> kept... Is there a way to
> achieve this?
>
> The only way I currently think of is to manually modify the generated
> DefaultFeatureCollection after
> GeoTools has parsed the XML file.
>
> The highest version of GeoTools I can use is 11.2 since our application
> uses Java 6.
>
> Thanks in advance!
>
> Julien
>
>
> ------------------------------------------------------------------------------
> Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
> Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
> Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
> Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
>
> http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
> _______________________________________________
> GeoTools-GT2-Users mailing list
> GeoTools-GT2-Users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>
------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
_______________________________________________
GeoTools-GT2-Users mailing list
GeoTools-GT2-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to