ST_MPolyFromText¶
Constructs a MultiPolygon from Well-Known Text (WKT), erroring if the input is not a MultiPolygon.
Usage¶
geometry ST_MPolyFromText(wkt: string)
geometry ST_MPolyFromText(wkt: string, srid: crs)
Arguments¶
- wkt (string)
- srid (crs)
Description¶
Parses a WKT string and returns a geometry. Raises an error if the WKT does not represent a MultiPolygon.
Examples¶
SELECT ST_MPolyFromText('MULTIPOLYGON (((0 0, 1 0, 1 1, 0 0)), ((2 2, 3 2, 3 3, 2 2)))');
┌──────────────────────────────────────────────────────────────────────────────┐
│ st_mpolyfromtext(Utf8("MULTIPOLYGON (((0 0, 1 0, 1 1, 0 0)), ((2 2, 3 2, 3 3 │
│ , 2 2)))"))… │
╞══════════════════════════════════════════════════════════════════════════════╡
│ MULTIPOLYGON(((0 0,1 0,1 1,0 0)),((2 2,3 2,3 3,2 2))) │
└──────────────────────────────────────────────────────────────────────────────┘
With an SRID or CRS:
SELECT ST_MPolyFromText('MULTIPOLYGON (((0 0, 1 0, 1 1, 0 0)), ((2 2, 3 2, 3 3, 2 2)))', 4326);
┌──────────────────────────────────────────────────────────────────────────────┐
│ st_mpolyfromtext(Utf8("MULTIPOLYGON (((0 0, 1 0, 1 1, 0 0)), ((2 2, 3 2, 3 3 │
│ , 2 2)))"),Int64(4326))… │
╞══════════════════════════════════════════════════════════════════════════════╡
│ MULTIPOLYGON(((0 0,1 0,1 1,0 0)),((2 2,3 2,3 3,2 2))) │
└──────────────────────────────────────────────────────────────────────────────┘