[udig-devel] Datastores, Features, and IGeoresources, oh my....

Dave S-B dev-lists at lledr-solutions.co.uk
Thu May 1 04:23:42 PDT 2008


I'm afraid I've got lost in the maze of IGeoResources, Datastores, 
Feature collections, IServices etc. etc. and I could do with some 
pointers on the way out!

Here's my predicament - I have a database which contains all manner of 
data relating to oil wells. I already have an analysis facility whereby 
the user can choose from a selection of many analyses, pick parameters 
(such as well operators, oil fields, drilling dates, etc.) and then get 
results based on their options. All the querying is done through JPA 
using Hibernate and the very useful HibernateSpatial, so what I'm 
getting from each analysis is a List<Object[]> where one of the items in 
the Object array is a JTS Geometry. I need to add a new layer to a map 
containing this data. I'd accept just being able to do it temporarily 
for now, but I'd like it to be persisted somehow (so the layer can 
recreate itself after closing down and restarting) - my Analysis object 
stores the user's options as a Map. I looked at the CreateTemporaryLayer 
example, but then got lost in creating a FeatureCollection!

I just need a way of thinking this through. At the moment, it seems to 
me as if I have to create;

- an Analysis DataStore, which wraps the existing Analysis object
- an Analysis FeatureReader (used by the DataStore), which reads the 
existing data and adapts it to Features
- an IService which stores the user-defined parameters (including some 
identifier to say which Analysis to run) and can create the DataStore on 
the fly
- an associated IGeoResource
- a ServiceExtension so uDig can recreate the service

Then, after the user picks their parameters I create a new 
AnalysisService (passing in the parameters as a Map). The 
AnalysisService is in charge of creating and running the Analysis. Then 
I can get the IGeoResource and use ApplicationGIS.addLayersToMap. Are 
the IService/IGeoResource details are persisted with the Layer? i.e. 
will the user-defined parameters get persisted somewhere if I include 
them in the IService.getConnectionParams()?

So that brings me on to URLs. Given that the user can create any number 
of analyses, do I need to make the URLs for the IService and 
IGeoResource unique in some way? Or is it enough that the connection 
parameters are different? If only the parameters need to be different 
then the URL could be something like "myApp:/analysis#results" - but I 
suspect the different analyses would interfere with each other 
somewhere. So would I need to have URLs like 
"myApp:/analysis/PoolSizeDistribution/1#results","myApp:/analysis/PoolSizeDistribution/2#results" 
etc.?

Sorry to be asking so many questions, but I've been playing with this 
for a couple of days now without success and I need a bit of a sanity 
check before I dive into creating all the above stuff! If anyone knows 
of a method which involves less code, I'd be glad to hear it!! ;)

Many thanks
Dave S-B
Lledr Solutions


More information about the udig-devel mailing list