Possible Duplicate:
Bulk load multiple shapefiles into PostGIS

Is it possible to bulk upload shp files into postgis. Im currently playing around with postgis, qgis and geoserver (as a potential arcgis server, arcmap and arcsde replacements) and want i want to be able to do is run a batch file (I guess) that will upload a number of shp files (exported from arcsde) that overwrite existing shp/tables files in postgis.

In effect postgis would be a slave database (for the time being).


Using shp2pgsql, you will have to write a script looping on each files located into one (or many folders).

The syntax will depend of your OS or the language script you want to use.

Here, is how to loop in bash script. Here on a set of files.

  • In case your PostGIS database uses a spatial index, create it after the data load is done. That is, in case the database has an spatial index before the bulk data load is done, drop it or the data load will likely be very slow. – dariapra Jul 30 '11 at 15:07

If you don't want to use Bash or a script you can use QGIS + PostGIS to do so under "layer-> add postgis layer" I think it does the same thing as @simo mentioned just with a GUI.

THe nice thing about this is that you get to see a progress bar as well as be able to set some of the fields, projections etc.

Not the answer you're looking for? Browse other questions tagged or ask your own question.