Roger writes:
I am trying to migrate from ARCGIS to QGIS (on the Mac). So far it seems to work quite well. I do have one question that I cannot seem to find an answer for and thought you may have some experience. I want convert ARCGIS shapefiles to postgis layers to do some querying on the associated databases. I’ve been trying to use the “SPIT” routine but it has me stumped. (I work better when I have examples that I can draw from.) So to use it I have to create a “connection”. The Connection box has several fields in it and am just not sure what goes into each box:
*Name:
I assume I can put anything in this?*Host:
Not a clue what goes into this field. Is it the “shapefile”.dbf file, or one of the other shapefile files (ARCGIS shapefiles are groups of files), or none of the above? And if the latter then what might it be?*Database:
The name of the postgis layer or the “shapefile”.dbf file?*Port:5432
Do I change this or leave it?Are the next two fields only for files that are password protected or on a network folder somewhere? Since I am using a shapefile that I moved onto my desktop there is no need to use a network username and pw, right?
*Username:
*Password:
Thanks for the help.
Anyone out there know the answers to Roger’s questions?









3 responses so far ↓
1 Anonymous // Sep 1, 2006 at 3:50 pm
well, you cannot use postgis to connect ot a shapefile dbf. if you have postgis installed (sounds like you dont) you can use shp2pgsql from the command line. if you have ogr/gdal, you can use ogr2ogr to convert shapefile to a postGIS table (again assuming you have postGIS installed).
in postGIS, database will be the naem of the database, and the usual port for postgresql is 5432. and you probably have your postgres set up iwth a username and password. which is what the other fields are for.
2 Anonymous // Sep 1, 2006 at 3:52 pm
and host will be ‘localhost’ assuming the database is on the same machine.
3 Matt Perry // Sep 1, 2006 at 9:27 pm
Roger,
First off you need to have postgis installed.. it does not come with qgis so you’ll have to install postgresql and postgis seperatly. See the postgres and postgis docs for details.
Once you’ve got them installed, to establish a postgis connection in qgis, you’ll need the following info:
* name : anything you want to describe the database connection (not the layer itself, a single database can hold many layers)
* Host: the hostname or IP address of the computer running postgresql. If you installed postgis on the same machine, ‘localhost’ will work.
* Database: The name of the postgresql database. This must be created beforehand and have the postgis extensions installed.
* Port: Postgres databases run on port 5432 by default. If you or the db administrator set it up otherwise, thats the only reason to change it.
* Username and password: The user name and password to log into the postgres database
Leave a Comment