CG_StraightSkeleton — Calcule un squelette (straight skeleton) à partir d'une géométrie
geometry CG_StraightSkeleton(geometry geom, boolean use_distance_as_m = false);
Computes the straight skeleton of a polygon by tracing the inward propagation of its edges. When use_distance_as_m is true, the M coordinate of each output point stores its distance from the input boundary.
Disponibilité : 3.5.0
Nécessite SFCGAL >= 1.3.8 pour l'option use_distance_as_m
Cette méthode nécessite le backend SFCGAL.
Cette fonction prend en charge la 3D et ne supprime pas l'indice z.
Cette fonction prend en charge les surfaces Polyhedral.
Cette fonction prend en charge les triangles et les réseaux irréguliers triangulés (TIN).
WITH data AS ( SELECT 'POLYGON((190 190,10 190,10 10,190 10,190 20,160 30,60 30,60 130,190 140,190 190))'::geometry AS polygon ) SELECT CG_StraightSkeleton(polygon) AS straight_skeleton FROM data;
MULTILINESTRING((190 190,164.03987973986756 164.03987973986756),(10 190,40.697077206292434 159.30292279370755),(10 10,35 35),(190 10,184.18861169915812 15.811388300841896),(190 20,184.18861169915812 15.811388300841896),(160 30,158.3772233983162 20),(60 30,50 20),(60 130,35 153.15077848154866),(190 140,164.03987973986756 164.03987973986756),(184.18861169915812 15.811388300841896,158.3772233983162 20),(50 20,158.3772233983162 20),(50 20,35 35),(35 153.15077848154866,35 35),(35 153.15077848154866,40.697077206292434 159.30292279370755),(164.03987973986756 164.03987973986756,40.697077206292434 159.30292279370755))
WITH data AS ( SELECT 'POLYGON((0 0,1 0,1 1,0 1,0 0))'::geometry AS polygon ) SELECT CG_StraightSkeleton(polygon, true) AS straight_skeleton_with_m FROM data;
MULTILINESTRING M ((0 0 0,0.5 0.5 0.5),(1 0 0,0.5 0.5 0.5),(1 1 0,0.5 0.5 0.5),(0 1 0,0.5 0.5 0.5))
Note that valid inputs with rings that touch at a single point will raise an error.
SELECT CG_StraightSkeleton('POLYGON((0 0,3 0,3 3,0 3,0 0),(0 0,1 2,2 1,0 0))'));
NOTICE: During straight_skeleton(A) : NOTICE: with A: POLYGON((0/1 0/1,3/1 0/1,3/1 3/1,0/1 3/1,0/1 0/1),(0/1 0/1,1/1 2/1,2/1 1/1,0/1 0/1)) ERROR: straight skeleton of Polygon with point touching rings is not implemented.