Hi Janos,


>> but how can I transfer data from e.g. postgis ?

Here is a small example (not tested) importing a query result as a layer :

(you may have to initiate postgresql driver with 'Class.forName("org.postgresql.Driver");'

try {
  String url = "">  String user = <user>;
  String pwd = <pwd>;
  String query = <query>;
  PostgisDSConnection connection = new PostgisDSConnection(DriverManager.getConnection(url, user, pwd));
  FeatureInputStream fis = connection.execute(new AdhocQuery(query));
  FeatureCollection dataset = new FeatureDataset(fis.getFeatureSchema());
  while (fis.hasNext()) {
    dataset.add(fis.next());
  }
  pluginContext.getLayerManager().addLayer(category, layerName, dataset);
} catch(Exception ex) {
  ex.printStackTrace();
}


I you want to link a postgis table to your project as a dynamic table, you can refer to the following class :

AddDataStoreLayerWizard

(There is also a different wizard for writable layer)

Not sure what you want to do. If you just want to open OpenJUMP with a layer connected to a database,

you can do it from the menu and save it in a project.

Michaël

_______________________________________________
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel

Reply via email to