[postgis-tickets] r14350 - Don't add unnecessary boxes during geography casting

Regina Obe lr at pcorp.us
Mon Nov 2 23:51:44 PST 2015


Author: robe
Date: 2015-11-02 23:51:43 -0800 (Mon, 02 Nov 2015)
New Revision: 14350

Modified:
   trunk/postgis/geography_inout.c
   trunk/postgis/geography_measurement.c
   trunk/regress/sfcgal/tickets_expected
   trunk/regress/tickets.sql
   trunk/regress/tickets_expected
Log:
Don't add unnecessary boxes during geography casting
references #3356 (fix for 2.3 branch)
references #3355 redo of fix for 2.3 branch for segmentize

Modified: trunk/postgis/geography_inout.c
===================================================================
--- trunk/postgis/geography_inout.c	2015-11-02 07:46:56 UTC (rev 14349)
+++ trunk/postgis/geography_inout.c	2015-11-03 07:51:43 UTC (rev 14350)
@@ -598,18 +598,9 @@
 		);
 	}
 
-	/*
-	** Serialize our lwgeom and set the geodetic flag so subsequent
-	** functions do the right thing.
-	*/
-	lwgeom_set_geodetic(lwgeom, true);
-	
-	/* Recalculate the boxes after re-setting the geodetic bit */
-	lwgeom_drop_bbox(lwgeom);
-	lwgeom_add_bbox(lwgeom);
-	
-	g_ser = geography_serialize(lwgeom);
 
+	g_ser = gserialized_geography_from_lwgeom(lwgeom, -1);
+
 	/*
 	** Replace the unaligned lwgeom with a new aligned one based on GSERIALIZED.
 	*/

Modified: trunk/postgis/geography_measurement.c
===================================================================
--- trunk/postgis/geography_measurement.c	2015-11-02 07:46:56 UTC (rev 14349)
+++ trunk/postgis/geography_measurement.c	2015-11-03 07:51:43 UTC (rev 14350)
@@ -1084,18 +1084,8 @@
 	/* Calculate the densified geometry */
 	lwgeom2 = lwgeom_segmentize_sphere(lwgeom1, max_seg_length);
 	
-	/*
-	** Set the geodetic flag so subsequent
-	** functions to do the right thing.
-	*/
-	lwgeom_set_geodetic(lwgeom2, true);
+	g2 = gserialized_geography_from_lwgeom(lwgeom2, -1);
 	
-	/* Recalculate the boxes after re-setting the geodetic bit */
-	lwgeom_drop_bbox(lwgeom2);
-	lwgeom_add_bbox(lwgeom2);
-	
-	g2 = geography_serialize(lwgeom2);
-	
 	/* Clean up */
 	lwgeom_free(lwgeom1);
 	lwgeom_free(lwgeom2);

Modified: trunk/regress/sfcgal/tickets_expected
===================================================================
--- trunk/regress/sfcgal/tickets_expected	2015-11-02 07:46:56 UTC (rev 14349)
+++ trunk/regress/sfcgal/tickets_expected	2015-11-03 07:51:43 UTC (rev 14350)
@@ -212,7 +212,7 @@
 NOTICE:  SRID value -1 converted to the officially unknown SRID value 0
 #1596.6|public.road_pg.roads_geom SRID changed to 0
 #1596.7|0
-#1596|Point[BGS]
+#1596|Point[GS]
 #1695|MULTIPOLYGON EMPTY
 #1697.1|0
 #1697.2|0

Modified: trunk/regress/tickets.sql
===================================================================
--- trunk/regress/tickets.sql	2015-11-02 07:46:56 UTC (rev 14349)
+++ trunk/regress/tickets.sql	2015-11-03 07:51:43 UTC (rev 14350)
@@ -913,5 +913,17 @@
 
 SELECT '#3300', ST_AsText(ST_SnapToGrid(Box2D('CURVEPOLYGON(CIRCULARSTRING(-71.0821 42.3036,-71.4821 42.3036,-71.7821 42.7036,-71.0821 42.7036,-71.0821 42.3036),(-71.1821 42.4036,-71.3821 42.6036,-71.3821 42.4036,-71.1821 42.4036))'::Geometry)::geometry,0.0001));
 
+SELECT '#3355',  ST_Intersects(
+         'LINESTRING(124.983539 1.419224,91.181596 29.647798)'::geography
+       , ST_Segmentize('LINESTRING(124.983539 1.419224,91.181596 29.647798)'::geography, 47487290)::geography);
+
+SELECT '#3356', ST_Summary(wkt::geometry) As wkt_geom, 
+   ST_Summary(wkt::geography) As wkt_geog,
+   ST_Summary(wkt::geometry::geography) As geom_geog
+FROM (VALUES (
+     'LINESTRING(124.983539 1.419224,91.181596 29.647798)'::text ),
+ ('LINESTRING(124.983539 1.419224,91.181596 29.647798, 91.28 29.647)'::text  ) ) As f(wkt)
+ORDER BY wkt;
+
 -- Clean up
 DELETE FROM spatial_ref_sys;

Modified: trunk/regress/tickets_expected
===================================================================
--- trunk/regress/tickets_expected	2015-11-02 07:46:56 UTC (rev 14349)
+++ trunk/regress/tickets_expected	2015-11-03 07:51:43 UTC (rev 14350)
@@ -214,7 +214,7 @@
 NOTICE:  SRID value -1 converted to the officially unknown SRID value 0
 #1596.6|public.road_pg.roads_geom SRID changed to 0
 #1596.7|0
-#1596|Point[BGS]
+#1596|Point[GS]
 #1695|MULTIPOLYGON EMPTY
 #1697.1|0
 #1697.2|0
@@ -277,3 +277,6 @@
 #2956|t
 #3172|LINESTRING M (0 0 1,0 0 2)
 #3300|POLYGON((-71.7821 42.2622,-71.7821 42.9067,-71.029 42.9067,-71.029 42.2622,-71.7821 42.2622))
+#3355|t
+#3356|LineString[] with 2 points|LineString[GS] with 2 points|LineString[GS] with 2 points
+#3356|LineString[B] with 3 points|LineString[BGS] with 3 points|LineString[BGS] with 3 points



More information about the postgis-tickets mailing list