Geometry construction
Construct geometry values with CAST or write JSON coordinate arrays to a geometry column. The aliases define how coordinates nest and validate the resulting shape.
Shapes
A Point is a pair of Float64 coordinates. MultiPoint, Ring and LineString are arrays of Points. A Polygon is an array of Rings, a MultiLineString is an array of LineStrings, and a MultiPolygon is an array of Polygons.
The declarations validate field types and nesting, not topological correctness. They do not detect self-intersections or assign a coordinate reference system.
Examples
A point and independent points
sql
SELECT CAST('[1,2]' AS Point),
CAST('[[1,2],[3,4]]' AS MultiPoint)
FORMAT csv;text
"[1,2]","[[1,2],[3,4]]"A polygon boundary
sql
SELECT CAST('[[[0,0],[2,0],[2,2],[0,2]]]' AS Polygon)
FORMAT csv;text
"[[[0,0],[2,0],[2,2],[0,2]]]"Use point_in_polygon to test containment. See geometry types for the alias table and GeoJSON for interchange.