名稱

ST_WrapX — 將幾何圖形環繞 X 值。

概要

geometry ST_WrapX(geometry geom, float8 wrap, float8 move);

描述

此函數會分割輸入的幾何圖形,然後將每個落在指定 'wrap' 線的右側(若 'move' 為負值)或左側(若 'move' 為正值)的結果元件,沿著 'move' 參數指定的方向移動,最後將這些片段重新合併在一起。

[Note]

這對於「重新置中」經緯度輸入非常有用,使感興趣的要素不會從一側延伸到另一側。

可用性:2.3.0 需要 GEOS

此函數支援 3D,並且不會捨棄 Z 索引。

範例

-- Move all components of the given geometries whose bounding box
-- falls completely on the left of x=0 to +360
select ST_WrapX(geom, 0, 360);

-- Move all components of the given geometries whose bounding box
-- falls completely on the left of x=-30 to +360
select ST_WrapX(geom, -30, 360);
        

另請參閱

ST_ShiftLongitude