ST_LineFromEncodedPolyline — 从编码折线创建 LineString。
geometry ST_LineFromEncodedPolyline(
text polyline, integer precision=5)
;
从编码多段线字符串创建 LineString。
可选precision
指定编码折线中将保留多少个小数位。 编码和解码时的值应该相同,否则坐标将不正确。
参照 http://developers.google.com/maps/documentation/utilities/polylinealgorithm
可用性:2.2.0
-- Create a line string from a polyline SELECT ST_AsEWKT(ST_LineFromEncodedPolyline('_p~iF~ps|U_ulLnnqC_mqNvxq`@')); -- result -- SRID=4326;LINESTRING(-120.2 38.5,-120.95 40.7,-126.453 43.252) -- Select different precision that was used for polyline encoding SELECT ST_AsEWKT(ST_LineFromEncodedPolyline('_p~iF~ps|U_ulLnnqC_mqNvxq`@',6)); -- result -- SRID=4326;LINESTRING(-12.02 3.85,-12.095 4.07,-12.6453 4.3252)