Skip to main content

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

Right off I see a problem. It is that you are adding features to a visible layer. What happens here is that each time a feature is added the map is re-rendered. What you should do is what you do in the second email. Add the features to the layer before the layer is added to the map. Or setVisible to be false on the map.... Oh wait we just fixed a bug yesterday. As of the next release setting the LayerVisibility to false will be sufficient but for now you have to add the features to a layer before it is in the map. (Or use the CopyFeaturesCommand.

Jesse

On 17-Nov-06, at 12:52 AM, Javier Cámara wrote:

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]
_______________________________________________
User-friendly Desktop Internet GIS (uDig)
http://udig.refractions.net
http://lists.refractions.net/mailman/listinfo/udig-devel



Back to the top