Add the ST_Geometry type to a PostgreSQL database

You can add the ST_Geometry type, subtype, and functions to your PostgreSQL database using the Create Spatial Type geoprocessing tool or a Python script.

The Create Spatial Type tool does the following:

Before running the tool, you must copy the st_geometry library to the PostgreSQL server.

The following steps explain how to install the ST_Geometry type in a PostgreSQL database:

Steps:
  1. Copy the st_geometry library from the DatabaseSupport directory in the ArcGIS client installation location and place it in the PostgreSQL lib directory. Be sure you copy the correct st_geometry library for the version of PostgreSQL and operating system you will be using.
    • The location of the lib directory on Linux can vary depending on how you installed PostgreSQL. To determine the correct location for your PostgreSQL installation, execute pg_config as the postgres user. The value that is returned for PKGLIBDIR is the lib directory where you need to place the st_geometry library. Log in as the root user to copy the file to the lib location.
    • If PostgreSQL is installed on a Windows server, place the st_geometry.dll file in the %PostgreSQL%\lib directory.
  2. If you have PostgreSQL installed on a Windows server, you must have the Microsoft Visual C++ 2008 SP1 Redistributable Package (x64) installed on the server. If it is not present on the PostgreSQL server, download it from the Microsoft site and install it.

    This is required to use the ST_Geometry type.

  3. Start ArcCatalog or ArcMap and open the Catalog window.
  4. Create a connection to your PostgreSQL database. Log in as the postgres user.
  5. Open the Create Spatial Type tool.

    You can use the Search window to search for the tool or open the tool from the Workspace toolset of the Data Management toolbox.

  6. Add the database connection you created in step 4 to the Input database workspace text box.
  7. Type a password for the sde user in the SDE User Password text box.
  8. Leave the Tablespace Name text box blank.
  9. Click OK to run the tool.

The ST_Geometry type, subtypes, and functions are created in the schema of the sde user.

Related Topics

2/5/2015