I think you would have to review the parse code, and prepare a pull request
allowing it to preserve order.

We used to have a global setting defining what implementation to use for
the default feature collection, but it was not being used. I am having more
luck with these explicit FeatureCollection implementations so developers
can notice their is a choice.

Jody

Jody Garnett

On Thu, Sep 25, 2014 at 4:58 AM, electrotype <electrot...@gmail.com> wrote:

>  Thanks for the reply Jody.
>
> But how can I tell the parse() method to use one implementation instead of
> another?
>
> I see the Parser's constructor can take a Configuration object, which
> seems to use PicoContainer and have a registerBindings() method... Is that
> the way to configure which implementation of the FeatureCollection I want
> it to use?
>
> Can you provide a small code example?
>
> Julien
>
>
>
>
> On 9/24/2014 4:01 PM, Jody Garnett wrote:
>
> 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
>
>
------------------------------------------------------------------------------
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