Skip to content
This repository has been archived by the owner on Nov 30, 2017. It is now read-only.

Proposal #8: improve shp2pg action

mbarto edited this page Jan 30, 2013 · 6 revisions

The Shp2pg action permits to copy a shapefile to postgis spatial table, but is currently quite limited in its functionality. It surely needs some refactoring to clean up the code, add some testing and generalize it a bit.

Proposal

We propose to generalize the action so that both the source and the destination of the copy can be any GeoTools datastore (shapefiles, jdbc databases, etc.). For clarity we think it's better to rename the action to ds2ds (or create a new one with this name and deprecate the old one).

The generalization shoulde be very simple to obtain, building both datastores from a set of Geotools connection parameters.

Also, the GeoServer publishing functionality should be removed, as a specific action already exists for that.

The generalization permits to easily introduce tests for the action, using shapefiles and embedded (H2) databases to avoid the necessity of an online postgis database.

The action should be used for appending or replacing existing data, so a flag will be added in configuration to specify the desired mode.

Finally the action should be chainable (now it's not), so we need to produce an output event. This event will be a file (a properties file), containing the output datastore connection parameters and the typename of the imported feature, as in the following example:

SPI=org.geotools.data.postgis.PostgisNGDataStoreFactory
host=localhost
port=5432
database=test
schema=public
user=postgres
passwd=mypassword
Loose bbox=true
Estimated extends=false
validate connections=true
Connection timeout=10
preparedStatements=false
typeName=poi

Created from issue #122