[postgis-tickets] [PostGIS] #3631: ST_LineFromEncodedPolyLine precision needs explanation

PostGIS trac at osgeo.org
Tue Sep 13 09:44:20 PDT 2016


#3631: ST_LineFromEncodedPolyLine precision needs explanation
---------------------------+---------------------------
 Reporter:  robe           |      Owner:  robe
     Type:  defect         |     Status:  new
 Priority:  medium         |  Milestone:  PostGIS 2.3.0
Component:  documentation  |    Version:  2.2.x
 Keywords:                 |
---------------------------+---------------------------
 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
 }}}

--
Ticket URL: <https://trac.osgeo.org/postgis/ticket/3631>
PostGIS <http://trac.osgeo.org/postgis/>
The PostGIS Trac is used for bug, enhancement & task tracking, a user and developer wiki, and a view into the subversion code repository of PostGIS project.


More information about the postgis-tickets mailing list