ST_ShiftLongitude

更新时间:
复制 MD 格式

Converts the longitude coordinates of a geometry object from the [-180, 0] degree range to [180, 360] degrees, or from [180, 360] degrees to [-180, 0] degrees.

Syntax

geometry ST_ShiftLongitude(geometry geomA);

Parameters

ParameterDescription
geomAThe input geometry object.

Usage notes

  • Applies only to geometry objects in a latitude/longitude coordinate system, such as World Geodetic System 1984 (WGS 84).

  • Preserves z coordinates of 3D objects.

  • Supports polyhedral surfaces, triangles, and triangulated irregular network (TIN) surfaces.

Examples

Shift a point with longitude 181° to its equivalent at -179°:

SELECT ST_AsText(ST_ShiftLongitude('POINT(181 30)'));
   st_astext
----------------
 POINT(-179 30)
(1 row)