Almost anything you do will be faster than MemoryDataStore. MemoryDataStore
uses a TreeSet to sort the contents by FeatureId - so it as slow as
anything.
Can I ask you to rase a bug about start index for MemoryDataStore. I
suspect that it is time to deprecate that implementation.
--
Jody
Jody Garnett
On Thu, Mar 20, 2014 at 11:31 PM, César Martínez Izquierdo <
cesar....@gmail.com> wrote:
> I have tried with GeoTools 11.0 and setStartIndex is still ignored with
> MemoryDataStore.
>
> I have switched to DataUtilities.souce( collection ) and it works fine now.
> Should I expect any performance gain or penalty from this change (I am
> using ListFeatureCollection)?
>
> Best regards,
>
> César
>
>
>
> 2014-03-20 9:31 GMT+01:00 Jody Garnett <jody.garn...@gmail.com>:
>
> You may be correct we did a big "FeatureCollection" simplification and
>> quality assurance check. Please report back if you are successful or not as
>> I am curious.
>>
>> Jody Garnett
>>
>>
>> On Thu, Mar 20, 2014 at 7:07 PM, César Martínez Izquierdo <
>> cesar....@gmail.com> wrote:
>>
>>> At the moment we are using Geotools 2.7 version, so maybe the error is
>>> or is not present in current Geotools versions. I will test if our code
>>> works with the latest version without changes, then I will report back the
>>> results. I will also try the DataUtilities.souce( collection ) method.
>>>
>>> Thanks for your hints Jody.
>>>
>>> César
>>>
>>>
>>> 2014-03-20 7:55 GMT+01:00 Jody Garnett <jody.garn...@gmail.com>:
>>>
>>> You are probably not doing anything wrong, StartIndex was added sometime
>>>> after MemoryDataStore so I expect a bug report and patch may be required.
>>>>
>>>> The whole paging thing is a bit tricky in that it assume a sort order,
>>>> the sort order used by MemoryDataStore is based on FeatureId, and I am not
>>>> sure any other sorting is supported / tested.
>>>>
>>>> In general I recommend using the DataUtilities.souce( collection ) or
>>>> DataUtilities.source( spatialIndexCollection) which offer an alternative to
>>>> MemoryFeatureCollection. More more information see
>>>> http://docs.geotools.org/latest/userguide/library/main/collection.html#performance-options
>>>>
>>>> Jody
>>>>
>>>> Jody Garnett
>>>>
>>>>
>>>> On Thu, Mar 20, 2014 at 6:37 AM, César Martínez Izquierdo <
>>>> cesar....@gmail.com> wrote:
>>>>
>>>>> I have a piece of legacy code to maintain, using a MemoryDataStore.
>>>>>
>>>>> At certain point, the following code is executed:
>>>>>
>>>>> MemoryDataStore ds = new MemoryDataStore(ftBuilder.buildFeatureType());
>>>>> sfs = (SimpleFeatureStore) ds.getFeatureSource(ftName);
>>>>> sfs.addFeatures(colection);
>>>>> .......
>>>>> Query query = new Query();
>>>>> query.setStartIndex(start);
>>>>> query.setMaxFeatures(limit);
>>>>> SimpleFeatureIterator it = sfs.getFeatures(query).features();
>>>>>
>>>>> The resulting iterator will honour the setMaxFeatures property, but
>>>>> setStartIndex is ignored. Is it supposed to work like this? Am I doing
>>>>> something wrong?
>>>>>
>>>>> Thanks in advance,
>>>>>
>>>>> César
>>>>>
>>>>> --
>>>>> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
>>>>> César Martínez Izquierdo
>>>>> GIS developer
>>>>> - - - - - - - - - - - - - - - - - - - -
>>>>> Blog: http://geotechnotes.wordpress.com/
>>>>> ETC-SIA: http://sia.eionet.europa.eu/
>>>>> Universitat Autònoma de Barcelona (SPAIN)
>>>>> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
>>>>>
>>>>>
>>>>> ------------------------------------------------------------------------------
>>>>> Learn Graph Databases - Download FREE O'Reilly Book
>>>>> "Graph Databases" is the definitive new guide to graph databases and
>>>>> their
>>>>> applications. Written by three acclaimed leaders in the field,
>>>>> this first edition is now available. Download your free book today!
>>>>> http://p.sf.net/sfu/13534_NeoTech
>>>>> _______________________________________________
>>>>> GeoTools-GT2-Users mailing list
>>>>> GeoTools-GT2-Users@lists.sourceforge.net
>>>>> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>>>>>
>>>>>
>>>>
>>>
>>>
>>> --
>>> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
>>> César Martínez Izquierdo
>>> GIS developer
>>> - - - - - - - - - - - - - - - - - - - -
>>> Blog: http://geotechnotes.wordpress.com/
>>> ETC-SIA: http://sia.eionet.europa.eu/
>>> Universitat Autònoma de Barcelona (SPAIN)
>>> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
>>>
>>
>>
>
>
> --
> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> César Martínez Izquierdo
> GIS developer
> - - - - - - - - - - - - - - - - - - - -
> Blog: http://geotechnotes.wordpress.com/
> ETC-SIA: http://sia.eionet.europa.eu/
> Universitat Autònoma de Barcelona (SPAIN)
> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
>
------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
_______________________________________________
GeoTools-GT2-Users mailing list
GeoTools-GT2-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users