ST_IsSimple

Definition

ST_IsSimple returns 1 (Oracle) or t (PostgreSQL) if the ST_Geometry object is simple; otherwise, it returns 0 (Oracle) or f (PostgreSQL).

Syntax

sde.st_issimple (g1 sde.st_geometry)

Return type

Boolean

Example

The table issimple_test is created with two columns. The pid column is a smallint data type containing the unique identifier for each row. The g1 ST_Geometry column stores the simple and nonsimple geometry samples.

CREATE TABLE issimple_test (pid smallint, g1 sde.st_geometry);

The INSERT statements insert two records into the issimple_test table. The first is a simple linestring because it doesn't intersect its interior. The second is nonsimple because it does intersect its interior.

Oracle

INSERT INTO ISSIMPLE_TEST VALUES (
1,
sde.st_linefromtext ('linestring (10 10, 20 20, 30 30)', 0)
);

INSERT INTO ISSIMPLE_TEST VALUES (
2,
sde.st_linefromtext ('linestring (10 10, 20 20, 20 30, 10 30, 10 20,
20 10)', 0)
);

PostgreSQL

INSERT INTO issimple_test VALUES (
1,
sde.st_linestring ('linestring (10 10, 20 20, 30 30)', 0)
);

INSERT INTO issimple_test VALUES (
2,
sde.st_linestring  ('linestring (10 10, 20 20, 20 30, 10 30, 10 20,
20 10)', 0)
);

The query returns the results of the ST_IsSimple function. The first record returns 1 because the linestring is simple, while the second record returns 0 because the linestring is not simple.

Oracle

SELECT pid, sde.st_issimple (g1) Is_it_simple
FROM ISSIMPLE_TEST;

PID 		Is_it_simple

1		1
2		0

PostgreSQL

SELECT pid, sde.st_issimple (g1) AS Is_it_simple
FROM issimple_test;

pid		is_it_simple

1		t
2		f

3/7/2012