[postgis-tickets] r15044 - Segmentize geography using equal length segments, (Hugo Mercier of Oslandia)
Regina Obe
lr at pcorp.us
Wed Aug 17 06:01:23 PDT 2016
Author: robe
Date: 2016-08-17 06:01:23 -0700 (Wed, 17 Aug 2016)
New Revision: 15044
Modified:
trunk/NEWS
trunk/liblwgeom/lwgeodetic.c
trunk/regress/geography.sql
trunk/regress/geography_expected
trunk/regress/sfcgal/tickets_expected
trunk/regress/tickets_expected
Log:
Segmentize geography using equal length segments, (Hugo Mercier of Oslandia)
Closes #3613
Closes #3539
Closes https://github.com/postgis/postgis/pull/90
Modified: trunk/NEWS
===================================================================
--- trunk/NEWS 2016-08-10 02:46:53 UTC (rev 15043)
+++ trunk/NEWS 2016-08-17 13:01:23 UTC (rev 15044)
@@ -37,7 +37,8 @@
- #3557, Geometry function costs based on query stats (Paul Norman)
- #3591, Add support for BRIN indexes
(Giuseppe Broccolo of 2nd Quadrant, Julien Rouhaud and Ronan Dunklau of Dalibo)
- - #3496 Make postgis non-relocateable (for extension install), schema qualify calls in functions (Regina Obe)
+ - #3496 Make postgis non-relocateable (for extension install),
+ schema qualify calls in functions (Regina Obe)
Should resolve once and for all for extensions #3494, #3486, #3076
* Performance Enhancements *
@@ -47,6 +48,7 @@
(Dan Baston)
- #3400, Minor optimization of PIP routines (Dan Baston)
- Make adding a line to topology interruptible (Sandro Santilli)
+ - #3613, Segmentize geography using equal length segments, (Hugo Mercier of Oslandia)
PostGIS 2.2.2
2016/03/22
Modified: trunk/liblwgeom/lwgeodetic.c
===================================================================
--- trunk/liblwgeom/lwgeodetic.c 2016-08-10 02:46:53 UTC (rev 15043)
+++ trunk/liblwgeom/lwgeodetic.c 2016-08-17 13:01:23 UTC (rev 15044)
@@ -1591,21 +1591,26 @@
{
int nsegs = 1 + d / max_seg_length;
int i;
- double dx, dy, dzz = 0, dmm = 0;
- g = g1;
- dx = (g2.lat - g1.lat) / nsegs;
- dy = (g2.lon - g1.lon) / nsegs;
+ double dzz = 0, dmm = 0;
+ double delta = d / nsegs;
/* The independent Z/M values on the ptarray */
if ( hasz ) dzz = (p2.z - p1.z) / nsegs;
if ( hasm ) dmm = (p2.m - p1.m) / nsegs;
+ g = g1;
p = p1;
for ( i = 0; i < nsegs - 1; i++ )
{
+ GEOGRAPHIC_POINT gn;
+ double heading;
+
+ /* Compute the current heading to the destination */
+ heading = sphere_direction(&g, &g2, (nsegs-i) * delta);
/* Move one increment forwards */
- g.lat += dx;
- g.lon += dy;
+ sphere_project(&g, delta, heading, &gn);
+ g = gn;
+
p.x = rad2deg(g.lon);
p.y = rad2deg(g.lat);
if ( hasz )
Modified: trunk/regress/geography.sql
===================================================================
--- trunk/regress/geography.sql 2016-08-10 02:46:53 UTC (rev 15043)
+++ trunk/regress/geography.sql 2016-08-17 13:01:23 UTC (rev 15044)
@@ -114,6 +114,9 @@
dumped as (SELECT (st_dumppoints(geom)).path[1] as id, (st_dumppoints(geom)).geom from seg)
SELECT 'segmentize_geography', max(st_distance(d1.geom::geography, d2.geom::geography, false))::int FROM dumped as d1, dumped as d2 where d2.id = d1.id + 1;
+-- 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);
+
-- 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-08-10 02:46:53 UTC (rev 15043)
+++ trunk/regress/geography_expected 2016-08-17 13:01:23 UTC (rev 15044)
@@ -28,3 +28,4 @@
#2422|1|1600|t|t|1400.230|1396.816|1400.230|1400.230
#2422|1|1068|f|f|1400.230|1396.816|1400.230|1400.230
segmentize_geography|49789
+segmentize_geography2|t
Modified: trunk/regress/sfcgal/tickets_expected
===================================================================
--- trunk/regress/sfcgal/tickets_expected 2016-08-10 02:46:53 UTC (rev 15043)
+++ trunk/regress/sfcgal/tickets_expected 2016-08-17 13:01:23 UTC (rev 15044)
@@ -240,4 +240,4 @@
#2110.1|f
#2110.2|t
#2110.3|t
-#2145|6792007
+#2145|6792004
Modified: trunk/regress/tickets_expected
===================================================================
--- trunk/regress/tickets_expected 2016-08-10 02:46:53 UTC (rev 15043)
+++ trunk/regress/tickets_expected 2016-08-17 13:01:23 UTC (rev 15044)
@@ -236,7 +236,7 @@
#2110.1|f
#2110.2|t
#2110.3|t
-#2145|6792007
+#2145|6792004
#2232|M 0 0 l 0 0 1 0 0 0 1 0 0 0
#2307|MULTIPOLYGON(((-41.1932 -7.3257,-41.1616 -7.3257,-41.1569 -7.3257,-41.1569 -7.3483,-41.1932 -7.3483,-41.1932 -7.3257),(-41.1616 -7.3257,-41.1879 -7.3257,-41.1879 -7.3425,-41.1616 -7.3425,-41.1616 -7.3257)))
#2409|GeometryCollection[B] with 2 elements
More information about the postgis-tickets
mailing list