[PostGIS] #5654: Missing line segment with self-intersection and MVT

PostGIS trac at osgeo.org
Mon Mar 18 08:21:39 PDT 2024


#5654: Missing line segment with self-intersection and MVT
-----------------------+------------------------------------
  Reporter:  mhkeller  |      Owner:  pramsey
      Type:  defect    |     Status:  new
  Priority:  medium    |  Milestone:  PostGIS 3.4.3
 Component:  postgis   |    Version:  3.4.x
Resolution:            |   Keywords:  mvt, self-intersection
-----------------------+------------------------------------
Comment (by tjcaverly):

 This issue is also described here
 https://gis.stackexchange.com/questions/471851/missing-line-segment-when-
 serving-a-vector-tile-from-postgis

 The problem is in the algorithm used by `ST_SIMPLIFY` with tolerance = 0.

 So
 {{{
 select st_astext(
     st_simplify(
     'LINESTRING (2 2,3 2,4 1,3 2, 4 4)'
     ,0)
     );
 }}}

 incorrectly removes the 3rd point. This will happen whenever a linestring
 contains consecutive points A, B and C with A=C. This will affect any
 vector tile geoms created with `ST_ASMVTGEOM` containing such linestrings,
 as long as the whole linestring is on one tile.


 `ST_SIMPLIFY` tolerance = 0 uses `ptarray_simplify_in_place_tolerance0`,
 which will remove point B between A and C if it is exactly on line segment
 A, C, however it needs special handling for the case when A=C since this
 will cause false positives. This could be fixed by always keeping point B
 in cases with A = C. (I think removing consecutive duplicate points is
 handled in a separate step and doesn't need to be done here)
-- 
Ticket URL: <https://trac.osgeo.org/postgis/ticket/5654#comment:4>
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