Working with Databases

From OpenJUMP Wiki
Revision as of 19:45, 2 December 2012 by Michaudm (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

back to New User Guide Index page


References

Database connection

Several plugins, in OpenJUMP, make use of DataBase connections

  • DataStore Layer available in Files > Open...
  • Run DataStore Query available in Files
  • Save As PostGIS available in the layer contextuel menu : write click on the layer, then choose Save Dataset As... and select the PostGIS table format

All these plugins use the same Connection selector
SelectConnection.png

The right blue icon representing a DataBase open the Connection Manager
ConnectionManager.png

Adding a new connection open the following dialog box to configure the connection
ConfigureConnection.png

To get more details about connection configuration, go to Configure a DataBase Connection (to be written)

Connecting a layer to a table

To connect a Layer to a DataBase (AKA DataStore layer), choose the DataStore Layer option, in Files > Open... menu. Once a connection has been selected (see previous chapter), you can choose a table name and the database column containing the geometry to load as the feature geometry (a database table may have several geometries per feature).
OpenDataStoreConnection.png

This plugin creates a dynamic, read-only layer : each modification made in the view (zoom, pan...) will load the data intersecting the viewport.
Warning : OpenJUMP layer does not represent the whole table but only the part visible in the viewPort. Making a query against the layer in OpenJUMP is not equivalent to making a query against the whole table in the database.


Creating a layer from a query

The plugin Run DataStore Query is found directly uneder the File menu.
Compared to the previous plugin, this one creates read/write layers. It is not dynamic (does not reload data after each zoom/pan) and it lets the user create any SQL query (queries involving several tables for example).
The three buttons on the right side (view, fence, selection) makes it possible to create queries which are sensitive to OpenJUMP context. It is a powerful way to make DataStore Queries more dynamic.
See the Run DataStore Query page to learn more about how to use this plugin. (to be written)
RunDataStoreQuery.png

Since version 1.4.1, a layer created from a DataStore Query is linked to its DataSource, which means :

  • it can be saved in the project (the query is saved, not the data)
  • it can be refreshed at any time (right click on the layer name, then Database > Refresh DataStore Query)

Of course, refreshing a layer issued from a DatStore Query will loose the modifications you may have done on this layer (see Saving as PostGIS table)

Saving a Layer to a PostGIS table

Since OpenJUMP 1.6, a new plugin replaces the old PostGIS extension to upload data from OpenJUMP into a PostgreSQL/PostGIS database. To get it, right click on the layer, then choose Save Dataset As..., and select the PostGIS table format. The new plugin is tightly related to the previous ones in two ways :

  • it shares the same user interface to connect to a database
  • when a new layer is saved as a PostGIS table, it automatically creates a datasource of type DataStore Query, so that it can be saved in the projet file, modified, and refreshed.

The plugin has 5 main options to save data into a PostGIS table. These options are explained in Save to PostGIS page (to be written).
SaveAsPostGISTable.png


Other resources

See also Plugins for OpenJUMP

PostgreSQL/PostGIS

Oracle

MySQL


back to New User Guide Index page