ST_Polygon

Definition

The ST_Polygon accessor function takes a well-known text (WKT) representation and a spatial reference ID (SRID) and generates an ST_Polygon.

NoteNote:

When creating spatial tables that will be used with ArcGIS, it is best to create the column as ST_Geometry rather than specifying an ST_Geometry subtype, such as ST_Polygon.

Syntax

Oracle

sde.st_polygon (wkt clob, srid integer)

PostgreSQL

sde.st_polygon (wkt clob, srid integer)
sde.st_polygon (esri_shape bytea, srid integer)

SQLite

st_polygon (wkt text, srid int32)

Return type

ST_Polygon

Example

The following CREATE TABLE statement creates the polygon_test tables, which have a single column, p1. Then the INSERT statement converts a ring (a polygon that is both closed and simple) into an ST_Polygon and inserts it into the p1 column using the ST_Polygon function.

Oracle

CREATE TABLE polygon_test (p1 sde.st_geometry);

INSERT INTO polygon_test VALUES (  
 sde.st_polygon ('polygon ((10.01 20.03, 20.94 21.34, 35.93 10.04, 10.01 20.03))', 4326)
);

PostgreSQL

CREATE TABLE polygon_test (p1 sde.st_geometry);

INSERT INTO polygon_test VALUES (  
 sde.st_polygon ('polygon ((10.01 20.03, 20.94 21.34, 35.93 10.04, 10.01 20.03))', 4326)
);

SQLite

CREATE TABLE poly_test (id integerp1 geometryblob);

SELECT AddGeometryColumn(
 NULL,
 'poly_test',
 'p1',
 4326,
 'polygon',
 'xy',
 'null'
);

INSERT INTO poly_test VALUES (  
 1,
 st_polygon ('polygon ((10.01 20.03, 20.94 21.34, 35.93 10.04, 10.01 20.03))', 4326)
);

Related Topics

6/19/2015