在插入时将几何字段转换为不同类型?

Cast geometry field as different type on insert?

如何将 geometry(MultiLineString,4326) 类型的字段 geom_one 转换或插入到 geometry(MultiLineStringZM,4326) 类型的字段 geom_two 中?

当我尝试使用 ST_Force_3D(geom_one) 插入时,它会产生以下错误:

ERROR: Column has M dimension but geometry does not
********** Error **********
ERROR: Column has M dimension but geometry does not
------------------------------------------------------------------------

SQL state: 22023
------------------------------------------------------------------------

注意:ST_Force3D() 用于 PostGIS 2.1 及更新版本。

你用错了函数,

ST_Force3D Force the geometries into XYZ mode. This is an alias for ST_Force3DZ.

你想要什么..

ST_Force4D — Force the geometries into XYZM mode.

MultiLineStringZM 有一个 Z 和一个 M 维度。这使它成为 4D。