名称

ST_MPolyFromText — 使用给定的 SRID 从 WKT 创建一个多面几何。如果未给定 SRID,则默认为 0。

语法

geometry ST_MPolyFromText(text WKT, integer srid);

geometry ST_MPolyFromText(text WKT);

说明

使用给定的 SRID 从 WKT 创建一个多面。如果未给定 SRID,则默认为 0。

OGC 规范 3.2.6.2 - 选项 SRID 来自一致性套件

如果 WKT 不是多面,则抛出错误

[Note]

如果您绝对确定所有 WKT 几何都是多面,请不要使用此函数。它比 ST_GeomFromText 慢,因为它添加了一个额外的验证步骤。

此方法实现了 SQL 1.1 的 OGC 简单要素实现规范。

s3.2.6.2

此方法实现了 SQL/MM 规范。

SQL-MM 3: 9.6.4

示例

SELECT ST_MPolyFromText('MULTIPOLYGON(((0 0 1,20 0 1,20 20 1,0 20 1,0 0 1),(5 5 3,5 7 3,7 7 3,7 5 3,5 5 3)))');
SELECt ST_MPolyFromText('MULTIPOLYGON(((-70.916 42.1002,-70.9468 42.0946,-70.9765 42.0872,-70.9754 42.0875,-70.9749 42.0879,-70.9752 42.0881,-70.9754 42.0891,-70.9758 42.0894,-70.9759 42.0897,-70.9759 42.0899,-70.9754 42.0902,-70.9756 42.0906,-70.9753 42.0907,-70.9753 42.0917,-70.9757 42.0924,-70.9755 42.0928,-70.9755 42.0942,-70.9751 42.0948,-70.9755 42.0953,-70.9751 42.0958,-70.9751 42.0962,-70.9759 42.0983,-70.9767 42.0987,-70.9768 42.0991,-70.9771 42.0997,-70.9771 42.1003,-70.9768 42.1005,-70.977 42.1011,-70.9766 42.1019,-70.9768 42.1026,-70.9769 42.1033,-70.9775 42.1042,-70.9773 42.1043,-70.9776 42.1043,-70.9778 42.1048,-70.9773 42.1058,-70.9774 42.1061,-70.9779 42.1065,-70.9782 42.1078,-70.9788 42.1085,-70.9798 42.1087,-70.9806 42.109,-70.9807 42.1093,-70.9806 42.1099,-70.9809 42.1109,-70.9808 42.1112,-70.9798 42.1116,-70.9792 42.1127,-70.979 42.1129,-70.9787 42.1134,-70.979 42.1139,-70.9791 42.1141,-70.9987 42.1116,-71.0022 42.1273,
	-70.9408 42.1513,-70.9315 42.1165,-70.916 42.1002)))',4326);

另请参阅

ST_GeomFromText, ST_SRID