Name

ST_ExteriorRing — Renvoie une ligne représentant l'anneau extérieur d'un polygone.

Synopsis

geometry ST_ExteriorRing(geometry a_polygon);

Description

Renvoie une LINESTRING représentant l'anneau extérieur (coquille) d'un POLYGONE. Renvoie NULL si la géométrie n'est pas un polygone.

[Note]

Cette fonction ne prend pas en charge les MULTIPOLYGONES. Pour les MULTIPOLYGONs, utilisez conjointement avec ST_GeometryN ou ST_Dump

Cette méthode implémente la spécification OGC Simple Features Implementation Specification for SQL 1.1.

2.1.5.1

Cette méthode implémente la spécification SQL/MM.

SQL-MM 3 : 8.2.3, 8.3.3

Cette fonction prend en charge la 3D et ne supprime pas l'indice z.

Exemples

--If you have a table of polygons
SELECT gid, ST_ExteriorRing(geom) AS ering
FROM sometable;

--If you have a table of MULTIPOLYGONs
--and want to return a MULTILINESTRING composed of the exterior rings of each polygon
SELECT gid, ST_Collect(ST_ExteriorRing(geom)) AS erings
        FROM (SELECT gid, (ST_Dump(geom)).geom As geom
                        FROM sometable) As foo
GROUP BY gid;

--3d Example
SELECT ST_AsEWKT(
        ST_ExteriorRing(
        ST_GeomFromEWKT('POLYGON((0 0 1, 1 1 1, 1 2 1, 1 1 1, 0 0 1))')
        )
);

st_asewkt
---------
LINESTRING(0 0 1,1 1 1,1 2 1,1 1 1,0 0 1)

Voir aussi

ST_InteriorRingN, ST_Boundary, ST_NumInteriorRings