PgAdmin III Plug-in Registration: PostGIS Shapefile and DBF Loader

PgAdmin 1.9+ has a simple Plug-In architecture which makes it relatively simple to introduce new plugins. It is pretty much all controlled by the file plugins.ini. In that file you can register any executable you want in there. If you want the executable to get passed database configuration settings, there is an option for that and you just have to build your executable to accept commandline switches.

You can download the windows version from http://postgis.net/windows_downloads. If you just want it without the PostGIS 1.5 binaries -- just download the one labeled PostGIS ESRI Shapefile GUI.

To enable said plugin, do the following:

  1. Open PgAdmin, and verify the location of the bin folder by choosing Options from the File menu
  2. You may want to change the location if its pointing at an old PostgreSQL or PgAdmin III install.
  3. Copy the postgisgui into the bin folder noted in the above dialog.
  4. Edit the plugins.ini file in your PgAdmin III install folder by adding the following lines (found in the ReadMe) or overwrite the plugins.ini with the packaged one, assuming you have no custom items in plugins.ini:
    
    ;
    ;PostGIS shp2pgsql-gui (Windows):
    ;
    Title=PostGIS Shapefile and DBF loader
    Command="$$PGBINDIR\postgisgui\shp2pgsql-gui.exe" -h "$$HOSTNAME" -p $$PORT -U "$$USERNAME" -d "$$DATABASE" -W "$$PASSWORD"
    Description=Open a PostGIS ESRI Shapefile or Plain dbf loader console to the current database.
    KeyFile=$$PGBINDIR\postgisgui\shp2pgsql-gui.exe
    Platform=windows
    ServerType=postgresql
    Database=Yes
    SetPassword=Yes
    	
    
  5. Reopen PgAdmin and your Plugins menu should look like:
  6. If you don't have a database selected, the menu options will be disabled, but once you have a database selected, then you should be able to click the loader icon and get a screen like this.
  7. If you click the Options button

    you can fine tune things a little, like for long lat data choosing to load in the new geography data type.

    NOTE: That for geography your data most already be in WGS 84 long lat (4326) which is the only spatial ref supported for geography since transform support is not currently built into the PostGIS loaders. For data you get from Tiger and Census boundary files(although they are in NAD 83 long lat (4269), you can get away with lying and calling it 4326 for most use cases, since they are almost identical in spheroid,datum etc to the WGS 84 one)