ST_IsClosed

Définition

ST_IsClosed accepte un objet ST_LineString ou ST_MultiLineString et renvoie 1 (Oracle et SQLite) ou t (PostgreSQL) s'il est fermé. Dans le cas contraire, la fonction renvoie 0 (Oracle et SQLite) ou f (PostgreSQL).

Syntaxe

Oracle et PostgreSQL

sde.st_isclosed (line1 sde.st_geometry)
sde.st_isclosed (multiline1 sde.st_geometry)

SQLite

st_isclosed (geometry1 geometryblob)

Type de retour

Booléen

Exemples

Test d'un objet linestring

La table closed_linestring est créée avec une seule colonne d'objets linestring.

Les instructions INSERT suivantes insèrent deux entrées dans la table closed_linestring. La première entrée n'est pas un objet linestring fermé, la deuxième en est un.

La requête renvoie les résultats de la fonction ST_IsClosed. La première ligne renvoie un 0 ou f puisque l'objet linestring n'est pas fermé et la deuxième ligne renvoie un 1 ou t puisque l'objet linestring est fermé.

Oracle

CREATE TABLE closed_linestring (ln1 sde.st_geometry);
INSERT INTO CLOSED_LINESTRING VALUES (
 sde.st_linefromtext ('linestring (10.02 20.01, 10.32 23.98, 11.92 25.64)', 4326)
);

INSERT INTO CLOSED_LINESTRING VALUES (
 sde.st_linefromtext ('linestring (10.02 20.01, 11.92 35.64, 25.02 34.15, 19.15 33.94, 10.02 20.01)', 4326)
);
SELECT sde.st_isclosed (ln1) Is_it_closed
 FROM CLOSED_LINESTRING;

Is_it_closed

0
1

PostgreSQL

CREATE TABLE closed_linestring (ln1 sde.st_geometry);
INSERT INTO closed_linestring VALUES (
 sde.st_linestring ('linestring (10.02 20.01, 10.32 23.98, 11.92 25.64)', 4326)
);

INSERT INTO closed_linestring VALUES (
sde.st_linestring ('linestring (10.02 20.01, 11.92 35.64, 25.02 34.15, 19.15 33.94, 10.02 20.01)', 4326)
);
SELECT sde.st_isclosed (ln1) AS Is_it_closed
FROM closed_linestring;

is_it_closed

f
t

SQLite

CREATE TABLE closed_linestring (id integer);

SELECT AddGeometryColumn (
 NULL,
 'closed_linestring',
 'ln1',
 4326,
 'linestring',
 'xy',
 'null'
);
INSERT INTO closed_linestring VALUES (
 1,
 st_linefromtext ('linestring (10.02 20.01, 10.32 23.98, 11.92 25.64)', 4326)
);

INSERT INTO closed_linestring VALUES (
 2,
 st_linefromtext ('linestring (10.02 20.01, 11.92 35.64, 25.02 34.15, 19.15 33.94, 10.02 20.01)', 4326)
);
SELECT st_isclosed (ln1)
 AS "Is_it_closed"
 FROM closed_linestring;

Is_it_closed

0
1

Test d'un objet multilinestring

La table closed_mlinestring est créée avec une seule colonne d'objets ST_MultiLineString.

Les instructions INSERT suivantes insèrent un enregistrement ST_MultiLineString non fermé et un enregistrement fermé.

Cette requête liste les résultats de la fonction ST_IsClosed. La première ligne renvoie la valeur 0 ou f puisque l'objet multilinestring n'est pas fermé. La deuxième ligne renvoie la valeur 1 ou t puisque l'objet multilinestring stocké dans la colonne ln1 est fermé. Un objet multilinestring est fermé si tous ses éléments linestring sont fermés.

Oracle

CREATE TABLE closed_mlinestring (mln1 sde.st_geometry);
INSERT INTO closed_mlinestring VALUES (
 sde.st_mlinefromtext ('multilinestring ((10.02 20.01, 10.32 23.98, 11.92 25.64), (9.55 23.75, 15.36 30.11))', 4326)
);

INSERT INTO closed_mlinestring VALUES (
 sde.st_mlinefromtext ('multilinestring ((10.02 20.01, 11.92 35.64, 25.02
34.15, 19.15 33.94, 10.02 20.01), (51.71 21.73, 73.36 27.04, 71.52 32.87, 52.43 31.90, 51.71 21.73))', 4326)
);
SELECT sde.st_isclosed (mln1) Is_it_closed
 FROM CLOSED_MLINESTRING;

Is_it_closed

0
1

PostgreSQL

CREATE TABLE closed_mlinestring (mln1 sde.st_geometry);
INSERT INTO closed_mlinestring VALUES (
 sde.st_mlinefromtext ('multilinestring ((10.02 20.01, 10.32 23.98, 11.92 25.64), (9.55 23.75, 15.36 30.11))', 4326)
);

INSERT INTO closed_mlinestring VALUES (
 sde.st_mlinefromtext ('multilinestring ((10.02 20.01, 11.92 35.64, 25.02
34.15, 19.15 33.94, 10.02 20.01), (51.71 21.73, 73.36 27.04, 71.52 32.87, 52.43 31.90, 51.71 21.73))', 4326)
);
SELECT st_isclosed (mln1)
 AS Is_it_closed
 FROM closed_mlinestring;

is_it_closed

f
t

SQLite

CREATE TABLE closed_mlinestring (mln1 geometryblob);

SELECT AddGeometryColumn (
 NULL,
 'closed_mlinestring',
 'mln1',
 4326,
 'multilinestring',
 'xy',
 'null'
);
INSERT INTO closed_mlinestring VALUES (
 st_mlinefromtext ('multilinestring ((10.02 20.01, 10.32 23.98, 11.92 25.64), (9.55 23.75, 15.36 30.11))', 4326)
);

INSERT INTO closed_mlinestring VALUES (
 st_mlinefromtext ('multilinestring ((10.02 20.01, 11.92 35.64, 25.02
34.15, 19.15 33.94, 10.02 20.01), (51.71 21.73, 73.36 27.04, 71.52 32.87, 52.43 31.90, 51.71 21.73))', 4326)
);
SELECT sde.st_isclosed (mln1)
 AS "Is_it_closed"
 FROM CLOSED_MLINESTRING;

Is_it_closed

0
1

Thèmes connexes

5/10/2014