[postgis-tickets] r15223 - Bug in geography ST_Segmentize
Regina Obe
lr at pcorp.us
Wed Nov 9 20:07:46 PST 2016
Author: robe
Date: 2016-11-09 20:07:45 -0800 (Wed, 09 Nov 2016)
New Revision: 15223
Modified:
trunk/liblwgeom/lwgeodetic.c
trunk/regress/geography.sql
trunk/regress/geography_expected
Log:
Bug in geography ST_Segmentize
Closes #3667 for PostGIS 2.4.0 (trunk)
Patch provided by Hugo Mercier (Oslandia)
Modified: trunk/liblwgeom/lwgeodetic.c
===================================================================
--- trunk/liblwgeom/lwgeodetic.c 2016-11-10 00:11:27 UTC (rev 15222)
+++ trunk/liblwgeom/lwgeodetic.c 2016-11-10 04:07:45 UTC (rev 15223)
@@ -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: trunk/regress/geography.sql
===================================================================
--- trunk/regress/geography.sql 2016-11-10 00:11:27 UTC (rev 15222)
+++ trunk/regress/geography.sql 2016-11-10 04:07:45 UTC (rev 15223)
@@ -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: trunk/regress/geography_expected
===================================================================
--- trunk/regress/geography_expected 2016-11-10 00:11:27 UTC (rev 15222)
+++ trunk/regress/geography_expected 2016-11-10 04:07:45 UTC (rev 15223)
@@ -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