- Catégories :
ST_MAKEPOLYGON , ST_POLYGON¶
Constructs a GEOGRAPHY or GEOGRAPHY object that represents a polygon without holes. The function uses the specified LineString as the outer loop.
- Voir aussi :
Syntaxe¶
ST_MAKEPOLYGON( <geography_or_geometry_expression> )
Arguments¶
geography_or_geometry_expression
A GEOGRAPHY or GEOMETRY object that represents a LineString in which the last point is the same as the first (i.e. a loop).
Renvoie¶
The function returns a value of type GEOGRAPHY or GEOMETRY.
Notes sur l’utilisation¶
The lines of the polygon must form a loop. Therefore, the last Point in the sequence of Points defining the LineString must be the same Point as the first Point in the sequence.
ST_POLYGON est un alias pour ST_MAKEPOLYGON.
For GEOMETRY objects, the returned GEOMETRY object has the same SRID as the input.
Exemples¶
GEOGRAPHY Examples¶
Cela montre une utilisation simple de la fonction ST_MAKEPOLYGON. La séquence de points ci-dessous définit une zone géodésique rectangulaire de 1 degré de large et de 2 degrés de haut, le coin inférieur gauche du polygone commençant à l’équateur (latitude) et à Greenwich (longitude). Le dernier point de la séquence est le même que le premier point, qui complète la boucle.
SELECT ST_MAKEPOLYGON( TO_GEOGRAPHY('LINESTRING(0.0 0.0, 1.0 0.0, 1.0 2.0, 0.0 2.0, 0.0 0.0)') ) AS polygon1; +--------------------------------+ | POLYGON1 | |--------------------------------| | POLYGON((0 0,1 0,1 2,0 2,0 0)) | +--------------------------------+
GEOMETRY Examples¶
This shows a simple use of the ST_MAKEPOLYGON function.
SELECT ST_MAKEPOLYGON( TO_GEOMETRY('LINESTRING(0.0 0.0, 1.0 0.0, 1.0 2.0, 0.0 2.0, 0.0 0.0)') ) AS polygon;+--------------------------------+ | POLYGON | |--------------------------------| | POLYGON((0 0,1 0,1 2,0 2,0 0)) | +--------------------------------+