Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [udig-devel] Data Import From In-Memory Data


Hello udig developers

Moeninf.

I'm just reading the tutorials and samples about IGeoResource, IService,
Feature, and so on. (uDIG 1.2 M6)

Sounds good.

I'm trying to import and display data from an in-memory data source. What is the best way to accomplish that?

There is a catalog method to make a temporary datastore for you to work from; right now it produces a memory datastore - I am hoping the H2 DataStore shapes up and we can make use of a temporary database on disk - when that switch occurs it should be seamless to your application.

The local catalog method needed is a bit non intuitive IMHO - you need to give it a magic object describing what you want. A featuretype to produce a datastore, and something else to produce a grid coverage.

createTemporaryResource( Object ) - used to create a temporary resources, usually by using a FeatureType


Conditions:
- Longitude & Latitude are stored in internal java objects (mapped through orm)
- Each longitude & latitude should be represented on the user interface by a small image.

On this page it has examples http://docs.codehaus.org/display/GEOTDOC/03+SimpleFeatureTypeBuilder+and+SimpleFeatureBuilder

Including...

 SimpleTypeBuilder builder = new SimpleTypeBuilder();
  builder.setName( "Flag" );
  builder.setNamespaceURI( "http://localhost/" );
  builder.setCRS( DefaultGeographicCRS.WSG84 );
  
  //add attributes in order
  builder.add( "Location", Point.class );
  builder.add( "ID", Integer.class );
  builder.add( "Name", String.class );
  
  //build the type
  final SimpleFeatureType FLAG = builder.buildFeatureType();

If you pass the above FLAG SImpleFeatureType to createTemporaryResource you should be good to go.

Are there UML diagrams which can enhance the appreciation of the internal
data structures such as IGeoResource, IService, ...?

There are in the commercial training materials; I update the online documentation based on questions here on the developer list. This week I am busy getting ready for the FOSS4G conference. 

At the bottom of the catalog page mentioned above is a class diagram showing the central idea of IGeoResource and IService (they are a like a file handle - they represent some content - but no content is fetched until you ask for it). Similar to how the java class File works - no content is fetched until you open an input stream. Methods on the handle will be able to answer some questions without hitting disk (what is the name of the resource); and some questions will require checking (what is the title of the resource).


Jody

Back to the top