[udig-devel] How to programmatically add a new layer displaying what's inside a FeatureCollection ?

Benjamin CABÉ benjamin.cabe at anyware-tech.com
Tue Jan 8 15:15:21 PST 2008


Hi all,

I'm quite new to uDig and... I already love it :-)
I am afraid I've not yet understood very well every basic uDig concept 
(IGeoResources, IServices, ...) ; and here is what I'd like to be able 
to do :

* Context :
I have a data-access layer that allows me to query an XML database 
(eXist), retrieving a FeatureCollection (the schema of the 
FeatureCollection depends on the query structure).
I need to add this FeatureCollection as a new layer on an existing map, 
whose underlying layer is a world map (shapefile)

*What I already managed to do :
    - programmatically create a new map (when the first query is 
executed)  displaying a world map shapefile ; no problem at all :-)
    - adding a new layer displaying the FeatureCollection returned by a 
query

*My problems (sorry if I am not able to describe them as well as I'd 
like to :-/)
    - for "results" layers, I create a temporary resource based on the 
FeatureCollection's schema 
(CatalogPlugin.getDefault().getLocalCatalog().createTemporaryResource(featureCollection.getFeatureType()); 
and i then resolve this resource into a FeatureStore which I fill with 
my FeatureCollection's Features ...
             - *but* ... if the FeatureType of FeatureCollection changes 
, I can't create a temp resource anymore : "Schema modification not 
supported" (?)
             - even if the structure doesn't change, every layer 
corresponding to every FeatureCollection seems to share the same storage 
area and every layer "graphically" displays the union of all the 
Features owned by all the FeatureCollections :-(


Well, as you might have noticed, I'm absolutely not a uDig (nor 
Geotools) expert. I think I just need some hints to know how to obtain 
an IGeoResource from a FeatureCollection ...!

On the other hand, I'm not that bad in Eclipse based development, and I 
hope I'll be able to contribute a solution to be able to display Maps in 
an Eclipse view instead of being stuck with a MapEditor when you only 
need (and want) to _display_ maps :-)

Thanks (a lot) for your answers,
Benjamin.


More information about the udig-devel mailing list