Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[udig-devel] New Layer with filtered features (uDig, uDig...we have a problem!!!)

Hi list!!!

First of all ... a little presentation...

We are developing a set of plugins which we want to upload to svn as soon as possible.

After that...we are trying to solve a set of problems, and a little bit of help will be very appreciate.

The most urgent problem is about a common task:
1) Take a layer with features
2) Filter the layer
3) Create a new layer with the filtered features

Well, I know that it's 'solve' in lists and Codehaus, but we can't do it run properly.
   
We use the next sequence:
---------------------------------------------------------------------------------------------------
IGeoResource memoryRsc = CatalogPlugin.getDefault().getLocalCatalog()
                            .createTemporaryResource( layer.getSchema());

Layer newLayer = ((Map) layer.getMap()).getLayerFactory()
                            .createLayer(memoryRsc);

FeatureSource fsource = layer.getResource(FeatureSource.class, new NullProgressMonitor());
FeatureCollection filterColl = fsource.getFeatures(queryFilter);

memoryRsc.resolve(FeatureStore.class, monitor).addFeatures(filterColl);
---------------------------------------------------------------------------------------------------
  
If we try a layer with a reduced number of features (around 50 features) it's works fine,
but...we try too with a heavy layer (around 50000 features) and the result is very discouraging:
the number of filtered features would be, for example, 20000, but the new layer only has 400 elements.
   
We don't know if the problem is the high number of elements, because we check a breakpoint
after the 'addFeatures' command and it don't stop the execution with the heavy layer...with a lite
layer, it works fine.

For the people who is working in a similar case...do you try with a high number of features?

Tracing the geotools code (addFeatures method), we can see that it use a FeatureWriter object and we try to model the same
behavoiur in our code (iterator over the filterColl), but we think that is a worng way...and we obtain the same results.

Thanks for your time!!!
   
Regards,

--
Javier Cámara


E.P. Desarrollo Agrario y Pesquero
C/ Bergantín 39
Sevilla [ESPAÑA]

Back to the top