[postgis-tickets] r15222 - Bug in geography ST_Segmentize
Regina Obe
lr at pcorp.us
Wed Nov 9 16:11:27 PST 2016
Author: robe
Date: 2016-11-09 16:11:27 -0800 (Wed, 09 Nov 2016)
New Revision: 15222
Modified:
branches/2.3/NEWS
branches/2.3/liblwgeom/lwgeodetic.c
branches/2.3/regress/geography.sql
branches/2.3/regress/geography_expected
Log:
Bug in geography ST_Segmentize
References #3667 for PostGIS 2.3.1
Patch provided by Hugo Mercier (Oslandia)
Modified: branches/2.3/NEWS
===================================================================
--- branches/2.3/NEWS 2016-10-31 15:35:12 UTC (rev 15221)
+++ branches/2.3/NEWS 2016-11-10 00:11:27 UTC (rev 15222)
@@ -8,6 +8,8 @@
- #3644, Deadlock on interrupt
- #3652, Crash on Collection(MultiCurve())
- #3656, Fix upgrade of aggregates from 2.2 or lower version
+ - #3667, geography ST_Segmentize bug
+ patch from Hugo Mercier (Oslandia)
PostGIS 2.3.0
2016/09/26
Modified: branches/2.3/liblwgeom/lwgeodetic.c
===================================================================
--- branches/2.3/liblwgeom/lwgeodetic.c 2016-10-31 15:35:12 UTC (rev 15221)
+++ branches/2.3/liblwgeom/lwgeodetic.c 2016-11-10 00:11:27 UTC (rev 15222)
@@ -949,6 +949,8 @@
f = (sin(e->lat) - sin(s->lat) * cos(d)) / (sin(d) * cos(s->lat));
if ( FP_EQUALS(f, 1.0) )
heading = 0.0;
+ else if ( FP_EQUALS(f, -1.0) )
+ heading = M_PI;
else if ( fabs(f) > 1.0 )
{
LWDEBUGF(4, "f = %g", f);
Modified: branches/2.3/regress/geography.sql
===================================================================
--- branches/2.3/regress/geography.sql 2016-10-31 15:35:12 UTC (rev 15221)
+++ branches/2.3/regress/geography.sql 2016-11-10 00:11:27 UTC (rev 15222)
@@ -117,6 +117,10 @@
-- Check that st_segmentize creates segments on the geodesic path
SELECT 'segmentize_geography2', st_dwithin(st_pointn(st_segmentize('linestring(1 47,-64 47)'::geography, 3000000)::geometry, 2), 'SRID=4326;POINT(-31.5 51.81)'::geometry, 0.01);
+-- #bug 3667
+SELECT 'segmentize_geography_3667', abs(ST_Length(geog) - ST_Length(ST_Segmentize(geog, 30000))) < 0.00001
+ FROM (SELECT ST_GeographyFromText('LINESTRING(38.769917 10.780694, 38.769917 9.106194)') As geog) AS f;
+
-- Clean up spatial_ref_sys
DELETE FROM spatial_ref_sys WHERE srid IN (4269,4326);
Modified: branches/2.3/regress/geography_expected
===================================================================
--- branches/2.3/regress/geography_expected 2016-10-31 15:35:12 UTC (rev 15221)
+++ branches/2.3/regress/geography_expected 2016-11-10 00:11:27 UTC (rev 15222)
@@ -29,3 +29,4 @@
#2422|1|1068|f|f|1400.230|1396.816|1400.230|1400.230
segmentize_geography|49789
segmentize_geography2|t
+segmentize_geography_3667|t
More information about the postgis-tickets
mailing list