ST_IsSimple

Definition

ST_IsSimple returns 1 (Oracle and SQLite) or t (PostgreSQL) if the geometry object is simple as defined by the Open Geospatial Consortium (OGC); otherwise, it returns 0 (Oracle and SQLite) or f (PostgreSQL).

Syntax

Oracle and PostgreSQL

sde.st_issimple (geometry1 sde.st_geometry)

SQLite

st_issimple (geometry1 geometryblob)

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 column stores the simple and nonsimple geometry samples.

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, as defined by the OGC, because it does intersect its interior.

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

Oracle

CREATE TABLE issimple_test (
 pid smallint,
 g1 sde.st_geometry
);
INSERT INTO ISSIMPLE_TEST VALUES (
 1,
 sde.st_linefromtext ('linestring (10 10, 20 20, 30 30)', 4326)
);

INSERT INTO ISSIMPLE_TEST VALUES (
 2,
 sde.st_linefromtext ('linestring (10 10, 20 20, 20 30, 10 30, 10 20,
20 10)', 4326)
);
SELECT pid, sde.st_issimple (g1) Is_it_simple
 FROM ISSIMPLE_TEST;

PID 		Is_it_simple

1		    1
2		    0

PostgreSQL

CREATE TABLE issimple_test (
 pid smallint,
 g1 sde.st_geometry
);
INSERT INTO issimple_test VALUES (
 1,
 sde.st_linestring ('linestring (10 10, 20 20, 30 30)', 4326)
);

INSERT INTO issimple_test VALUES (
 2,
 sde.st_linestring  ('linestring (10 10, 20 20, 20 30, 10 30, 10 20, 20 10)', 4326)
);
SELECT pid, sde.st_issimple (g1)
 AS Is_it_simple
 FROM issimple_test;

pid		is_it_simple

1	    	t
2	    	f

SQLite

CREATE TABLE issimple_test (
 pid integer
);

SELECT AddGeometryColumn (
 NULL,
 'issimple_test',
 'g1',
 4326,
 'linestring',
 'xy',
 'null'
);
INSERT INTO issimple_test VALUES (
 1,
 st_linestring ('linestring (10 10, 20 20, 30 30)', 4326)
);

INSERT INTO issimple_test VALUES (
 2,
 st_linestring  ('linestring (10 10, 20 20, 20 30, 10 30, 10 20, 20 10)', 4326)
);
SELECT pid, st_issimple (g1)
 AS Is_it_simple
 FROM issimple_test;

PID 		Is_it_simple

1		    1
2		    0

Related Topics

6/19/2015