ST_LineFromEncodedPolyline

更新时间:
复制 MD 格式

Constructs a LineString geometry from an encoded polyline string.

Syntax

geometry ST_LineFromEncodedPolyline(text polyline, integer precision);

Parameters

ParameterDescription
polylineThe encoded string that represents the polyline.
precisionThe number of decimal places encoded in the polyline string. The encoding precision and decoding precision must match — mismatched values produce inaccurate coordinates.

Usage notes

This function uses the Encoded Polyline Algorithm Format defined by Google Maps.

Examples

SELECT ST_AsText(ST_LineFromEncodedPolyline('_gvzE_ol{U_glW_c`|@_}hQ~flW'));

Output:

            st_astext
----------------------------------
 LINESTRING(120 36,130 40,126 43)
(1 row)