Opened 22 months ago

#5357 new defect

Invalid conversion of 2-points line in ST_LineFromEncodedPolyline

Reported by: perikrone Owned by: pramsey
Priority: medium Milestone: PostGIS PostgreSQL
Component: postgis Version: 3.2.x
Keywords: ST_LineFromEncodedPolyline Cc:

Description

In cases when encoded polyline consists of two points located close to each other ST_LineFromEncodedPolyline returns single point instead of pair. Example:

SELECT st_astext(ST_LineFromEncodedPolyline('__nphBgcoeiA?@', 6));
            st_astext
---------------------------------
 LINESTRING(38.903876 55.336448)

But if you try to convert this polyline in python, script results in correct pair of points. Python script:

import polyline

shape = polyline.decode("__nphBgcoeiA?@", precision=6)
print(rose_shape)

Result:

[[38.903876, 55.336448], [38.903875, 55.336448]]

Info about postgres and postgis:

SELECT PostGIS_Full_Version();

POSTGIS="3.2.2 628da50" [EXTENSION] PGSQL="140" GEOS="3.10.3-CAPI-1.16.1" PROJ="8.2.1" GDAL="GDAL 3.4.3, released 2022/04/22" LIBXML="2.9.7" LIBJSON="0.13.1" LIBPROTOBUF="1.3.0" WAGYU="0.5.0 (Internal)" RASTER

SELECT version();
PostgreSQL 14.4 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-10), 64-bit

Change History (0)

Note: See TracTickets for help on using tickets.