Updated on 2023-10-31 GMT+08:00

Using PostGIS

  • The third-party software that the PostGIS Extension depends on needs to be installed separately. If you need to use PostGIS, submit a service ticket or contact technical support to submit an application.
  • If the error message "ERROR: EXTENSION is not yet supported." is displayed, the PostGIS software package is not installed. Contact technical support.
  • The uuid-ossp extension has been preloaded in GaussDB(DWS). You can directly use the uuid function supported by GaussDB(DWS) without running the CREATE EXTENSION uuid-ossp command.

Creating PostGIS Extension

Run the CREATE EXTENSION command to create PostGIS Extension.

Using PostGIS Extension

Use the following function to invoke a PostGIS Extension:

GisFunction is the function, and Param1 and Param2 are function parameters. The following SQL statements are a simple illustration for PostGIS use. For details about related functions, see PostGIS 2.4.2 Manual.

Example 1: Create a geometry table.

Example 2: Insert geometry data.

Example 3: Calculate the distance between any two cities among three cities.

Deleting PostGIS Extension

Run the following command to delete PostGIS Extension from GaussDB(DWS):

If PostGIS Extension is the dependee of other objects (for example, geometry tables), you need to add the CASCADE keyword to delete all these objects.