1) On the database server
- Configure the PostGIS database to accept network (TCP/IP) connections
On the database server, edit the file postgresql.conf.
On Windows, it is found in the OpenGeo install user settings:
/Users/<opengeo user>/.opengeo/pgdata/<opengeo user>
On Ubuntu, it is found in:
/etc/postgresql/8.4/main
Uncomment and modify the line:
#listen_addresses = ‘localhost’
to
listen_addresses = ‘*’
- Create a login for network connections
Using pgAdmin, create a new login role named ‘mapinfo_app’.
Assign this login role ‘superuser’ privileges.
- Authenticate the new login
On the database server, edit the file pg_hba.conf.
On Windows, it is found in the OpenGeo install user settings:
/Users/<opengeo user>/.opengeo/pgdata/<opengeo user>
On Ubuntu, it is found in:
/etc/postgresql/8.4/main
Add a line at the end of the file:
host all all 192.168.1.0/24 password
It will allow all users with IP addresses starting with 192.168.1 to connect, provided they have a valid username / password.
Note: 192.168.1.0/16 would allow users with IP addresses starting with 192.168 to connect.
2) For each MapInfo client
- Download and install the PostgreSQL ODBC driver
From: http://www.postgresql.org/ftp/odbc/versions/msi/, download the file: psqlodbc_08_04_0200.zip
Unzip.
Execute the program psqlodbc.msi.
Choose all default installation options.
At the end of this installation, the PostgreSQL driver should be available.
- Configure a DSN connection
In 32-bit versions of Windows, start the ODBC sources administration console, in Control Panel > Administrative Tools.
In 64-bit versions of Windows, navigate to:
C:\Windows\SysWOW64\odbcad32.exe
In the System DSN tab, add a new driver and select the “PostgreSQL ANSI” driver.
Configure the driver as shown below:
where
<database-name> is the name of the database on the PostGIS server e.g. melbournegis
<server-IP> is the IP address of the server hosting the database.
5432 is the default port number on Ubuntu; on Windows, it is 54321
mapinfo_app is the login role created in the previous steps
Click the ‘Test’ button to make sure that the connection is successful.
Save.
- Open a PostGIS layer in MapInfo
In MapInfo, select File > Open DBMS Connection …
Select the data source created at the previous step from ‘Machine Data Source’ tab.
Select File > Open …
In “Files of type” drop down list, select the data source created at the previous step.
Select a layer from the ones available in the public schema.
