Opened 8 years ago

Closed 6 years ago

#3631 closed defect (fixed)

ST_LineFromEncodedPolyLine precision needs explanation

Reported by: robe Owned by: komzpa
Priority: medium Milestone: PostGIS 2.5.0
Component: documentation Version: 2.2.x
Keywords: Cc:

Description

In trying to debug why 32-bit winnie runs are failing, I came across this which made me wonder exactly what this precision argument is for.

SELECT ST_AsEWKT(ST_LineFromEncodedPolyline('_p~iF~ps|U_ulLnnqC_mqNvxq`@',5));

-- returns
SRID=4326;LINESTRING(-120.2 38.5,-120.95 40.7,-126.453 43.252)

SELECT ST_AsEWKT(ST_LineFromEncodedPolyline('_p~iF~ps|U_ulLnnqC_mqNvxq`@',6));

-- returns

SRID=4326;LINESTRING(-12.02 3.85,-12.095 4.07,-12.6453 4.3252)

This is on my:

PostgreSQL 9.6rc1, compiled by Visual C++ build 1800, 64-bit POSTGIS="2.3.0rc1dev r15100" GEOS="3.5.0-CAPI-1.9.0 r4090" PROJ="Rel. 4.9.1, 04 March 2015" GDAL="GDAL 2.1.0, released 2016/04/25" LIBXML="2.7.8" LIBJSON="0.12" (core procs from "2.3.0rc1dev r15096" need upgrade) RASTER (raster procs from "2.3.0rc1dev r15096" need upgrade)

It's not explained in docs, but as dbaston noted:

[12:42] <dbaston> robe2 I think the decoder needs to know what precision was used to create the encoded string
[12:42] <dbaston> the encoded polyline is not self-describing
[12:42] <dbaston> so if you decode with an incorrect precision, you get incorrect coordinates
[12:42] <robe2> dbaston ah that explains it.  I was beginning to think that
[12:42] <robe2> not explained well in docs
[12:43] <dbaston> well the precision parameter was actually ignored entirely in both the encoder and decoder, until a few days ago

Change History (6)

comment:1 by robe, 8 years ago

Milestone: PostGIS 2.3.0PostGIS 2.4.0

comment:2 by dbaston, 7 years ago

Owner: changed from robe to pramsey

comment:3 by robe, 7 years ago

Milestone: PostGIS 2.4.0PostGIS 2.5.0

comment:4 by pramsey, 7 years ago

Owner: changed from pramsey to dbaston

comment:5 by komzpa, 6 years ago

Owner: changed from dbaston to komzpa
Status: newassigned

comment:6 by komzpa, 6 years ago

Resolution: fixed
Status: assignedclosed

In 16651:

Document precision in EncodedPolyline.

Closes #3631

Note: See TracTickets for help on using tickets.