Monday, July 11, 2011

Connecting GeoMedia Professional to a read/write PostGIS database warehouse

Intergraph has released an open source GeoMedia PostGIS data server under the Apache 2.0 license on this site http://geomediapostgis.codeplex.com/. I downloaded and tried out creating and connecting to a read/write PostGIS warehouse on a Windows server from a remote client using the sample GeoMedia workspace USSampleData.gws. The instructions on the binaries talked about using Debian Linux as the host for the PostGIS database while I used Windows XP as the host instead.

Installing PostGIS 1.5 onto PostgreSQL 9.0 on Windows
After installing PostgreSQL 9.0 on Windows using the packaged installer on my server, I did the following:
  1. Download the PostGIS 1.5 Windows binaries from http://postgis.refractions.net/download/windows/pg90/postgis-pg90-binaries-1.5.3.zip
  2. Extract the files into a folder e.g. C:\Program Files\postgis-pg90-binaries-1.5.3.

  3. Use a text editor and open up the makepostgisdb.bat file.

  4. If necessary, change the PGPORT, PGHOST, PGUSER, and PGPASSWORD settings to match the Windows PostgreSQL installation.
  5. Uncomment the last line to create the database defined by the THEDB setting as a template PostGIS database e.g template_postgis15. Close and save the file.

  6. Run the batch file makepostgisdb.bat.

    PostGIS is installed and a template database is created.
Configure PostgreSQL for network access
By default, PostgreSQL is configured not to accept any network database requests. I had to do edit the configuration parameters to allow network access.
  1. On the server, select Start | All Programs | PostgreSQL 9.0 | pgAdmin III.

    The pgAdmin III application appears.
  2. In the Object browser pane, double click on the PostgreSQL 9.0 (localhost:5432) node. Enter the password if prompted.

    Connection to the server is established.
  3. Select Tools | Server Configuration | pg_hba.conf.

    The Backend Access Configuration Editor appears.
  4. Double click the empty last row.

    The Client Access Configuration dialog appears.
  5. Toggle Enabled on. Choose host for Type, all for Database, all for User and md5 for Method. Type in an appropriate IP Address for your network e.g. 192.168.8.0/24.

    Note: In this example, I am allowing access for any clients with the IP address pattern 192.168.8.*.
  6. Click OK.
  7. Select File | Save. Press Yes if prompted.
  8. Select File | Reload Server. Press Yes if prompted.
  9. Close the Client Access Configuration and Backend Access Configuration dialogs. 
Create and configure the Postgis database
  1. In the Object browser, expand and select Login Roles node.
  2. Select Edit | New Object | New Login Role.

    The New Login Role dialog box appears.
  3. In the Role Name field, type in gdouser. In the Password and Password(again) fields, type in gdouser.

  4. Click OK.

    The login is created.
  5. In the Object browser, select the Database(s) node.
  6. Select Edit | New Object | New Database.

    The New Database dialog box appears.
  7. In the Name field, type in gdotest. Choose gdouser as the Owner. Choose template_postgis15 as the Template.

  8. Click OK.

    The database is created.
Configuring the PostGIS GDO server on the client
  1. On the client machine, I downloaded the PostGISGDObin.zip package from http://geomediapostgis.codeplex.com and extracted to a folder e.g. C:\Program Files\PostGISGDO\.

  2. Run Register.bat.

    The data server is registered with GeoMedia.
  3. Double click the file PsgDBUtils.exe.

    The PostGIS GDO Database Utilities appear.
  4. Click New Connection.

    The New Connection dialog box appears.

  5. In the Server field, type in the address or name. In the Database field, type in gdotest. In the User field, type in gdouser. In the Password field, type in gdouser. Click OK.

    The utility is connected to the PostGIS database.
  6. Click Create INGR Metadata Tables.

    The metadata tables are created.
  7. Click Run script.

    The Open dialog box appears.
  8. Browse and choose the file USSampleProjCS.sql. Click Open. Click OK when prompted.

    Note: this script will add the Albers Equal Area coordinate system to the PostGIS database for working with the sample USSampleData.gws workspace.
  9. Click Close.
Connect to the PostGIS database from GeoMedia
  1. Start GeoMedia and open up the sample workspace USSampleData.gws.
  2. Select Warehouses | New Connection.

    The New Connection dialog box appears.
  3. Choose PostGIS Connection Type.
  4. In the Server field, type in the IP address or node name of the PostGIS server.
  5. In the Database field, type in gdotest.

  6. In the User and Password fields, type in gdouser. Click OK.

    GeoMedia is connected to the PostGIS database.

    Note: You should now have full read/write access to the PostGIS database.

No comments:

Post a Comment