From 4fee20abd39f9bd8b55895d678fe69b9997cb9bb Mon Sep 17 00:00:00 2001 From: Paul Ramsey Date: Sun, 9 Dec 2012 19:59:42 +0000 Subject: [PATCH] #2145, ST_Segmentize(geography, dist) fails with redundant coordinates git-svn-id: http://svn.osgeo.org/postgis/trunk@10820 b70326c6-7e19-0410-871a-916f4a2858ee --- liblwgeom/lwgeodetic.c | 6 ++++++ regress/tickets.sql | 4 ++++ regress/tickets_expected | 1 + 3 files changed, 11 insertions(+) diff --git a/liblwgeom/lwgeodetic.c b/liblwgeom/lwgeodetic.c index fc55a66e2..c92d8ecc3 100644 --- a/liblwgeom/lwgeodetic.c +++ b/liblwgeom/lwgeodetic.c @@ -1540,7 +1540,13 @@ ptarray_segmentize_sphere(const POINTARRAY *pa_in, double max_seg_length) /* Skip duplicate points (except in case of 2-point lines!) */ if ( (pa_in->npoints > 2) && p4d_same(&p1, &p2) ) + { + /* Move one offset forward */ + p1 = p2; + g1 = g2; + pa_in_offset++; continue; + } /* How long is this edge? */ d = sphere_distance(&g1, &g2); diff --git a/regress/tickets.sql b/regress/tickets.sql index 8adfd72d9..6afba5fb9 100644 --- a/regress/tickets.sql +++ b/regress/tickets.sql @@ -804,5 +804,9 @@ SELECT '#2117', ST_AsEWKT(ST_PointOnSurface('SRID=3395;MULTIPOLYGON M EMPTY'::ge SELECT '#2130', ST_NPoints(ST_GeomFromGeoJSON('{"type":"MultiPolygon","coordinates":[[[[-117,32],[-117,32],[-117,32],[-117,32],[-117,32],[-117,32],[-117,32],[-117,32],[-117,32],[-117,32],[-117,32],[-117,32],[-117,32],[-117,33],[-117,33],[-117,33],[-117,33],[-117,33],[-117,33],[-117,33],[-117,33],[-117,33],[-117,33],[-117,33],[-117,33],[-117,32],[-117,32],[-117,32],[-117,32],[-116,32],[-116,32],[-116,32],[-116,32],[-116,32],[-116,32],[-116,32],[-116,32],[-116,32],[-116,32],[-117,32],[-117,32],[-117,32],[-117,32]],[[-117,33],[-117,33],[-117,33],[-117,33],[-117,33],[-117,32],[-117,33]]]]}')); +SELECT '#2145', +round(ST_Length(St_Segmentize(ST_GeographyFromText('LINESTRING(-89.3000030518 28.2000007629,-89.1999969482 89.1999969482,-89.1999969482 89.1999969482)'), 10000))::numeric,0); + + -- Clean up DELETE FROM spatial_ref_sys; diff --git a/regress/tickets_expected b/regress/tickets_expected index 5c19052cb..670ed1fe2 100644 --- a/regress/tickets_expected +++ b/regress/tickets_expected @@ -236,3 +236,4 @@ ERROR: invalid GML representation #2108|SRID=3395;POINTM EMPTY #2117|SRID=3395;POINTM EMPTY #2130|8 +#2145|6792004 -- 2.50.1