ST_MakePoint — 建立 2D、3DZ 或 4D 點。
geometry ST_MakePoint(
float x, float y)
;
geometry ST_MakePoint(
float x, float y, float z)
;
geometry ST_MakePoint(
float x, float y, float z, float m)
;
建立 2D XY、3D XYZ 或 4D XYZM 點幾何。 使用 ST_MakePointM 來建立具有 XYM 坐標的點。
使用 ST_SetSRID 為建立的點指定 SRID。
雖然不符合 OGC 標準,但 ST_MakePoint
比 ST_GeomFromText 和 ST_PointFromText 更快且更精確。它也更容易用於數值坐標值。
![]() |
|
對於大地坐標, |
![]() |
|
函式 ST_Point、ST_PointZ、ST_PointM 和 ST_PointZM 可用於建立具有給定 SRID 的點。 |
此函式支援 3D,並且不會捨棄 z 索引。
-- Create a point with unknown SRID SELECT ST_MakePoint(-71.1043443253471, 42.3150676015829); -- Create a point in the WGS 84 geodetic CRS SELECT ST_SetSRID(ST_MakePoint(-71.1043443253471, 42.3150676015829),4326); -- Create a 3D point (e.g. has altitude) SELECT ST_MakePoint(1, 2,1.5); -- Get z of point SELECT ST_Z(ST_MakePoint(1, 2,1.5)); result ------- 1.5