]> granicus.if.org Git - postgis/commitdiff
Don't add unnecessary boxes during geography casting
authorRegina Obe <lr@pcorp.us>
Tue, 3 Nov 2015 07:51:43 +0000 (07:51 +0000)
committerRegina Obe <lr@pcorp.us>
Tue, 3 Nov 2015 07:51:43 +0000 (07:51 +0000)
references #3356 (fix for 2.3 branch)
references #3355 redo of fix for 2.3 branch for segmentize

git-svn-id: http://svn.osgeo.org/postgis/trunk@14350 b70326c6-7e19-0410-871a-916f4a2858ee

postgis/geography_inout.c
postgis/geography_measurement.c
regress/sfcgal/tickets_expected
regress/tickets.sql
regress/tickets_expected

index 1308fae3a245351c98906f54a1324502cae1130a..732e5a8cbee28a5f0d4d443a712865e2e1e16c00 100644 (file)
@@ -598,17 +598,8 @@ Datum geography_from_geometry(PG_FUNCTION_ARGS)
                );
        }
 
-       /*
-       ** 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.
index ec29916c557d851e55b0b7b5ac754de5b6a94a5b..fa8f17420bce6e5bd861389065c760b4fbdbd8bd 100644 (file)
@@ -1084,17 +1084,7 @@ Datum geography_segmentize(PG_FUNCTION_ARGS)
        /* 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);
-       
-       /* Recalculate the boxes after re-setting the geodetic bit */
-       lwgeom_drop_bbox(lwgeom2);
-       lwgeom_add_bbox(lwgeom2);
-       
-       g2 = geography_serialize(lwgeom2);
+       g2 = gserialized_geography_from_lwgeom(lwgeom2, -1);
        
        /* Clean up */
        lwgeom_free(lwgeom1);
index 1e82dc32cbe29031c006009829ee82231c582987..3cfe2aae828840bf57087bda90a680023f4ffed1 100644 (file)
@@ -212,7 +212,7 @@ ERROR:  invalid SRID: 999000 not found in spatial_ref_sys
 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
index 47391a310b5760853c1bc05abfb4e852c4404836..5a651eab6f0b19f33297cff78daf4c89cc9c8043 100644 (file)
@@ -913,5 +913,17 @@ SELECT '#3172', ST_AsText(ST_AddMeasure('LINESTRING(0 0,0 0)', 1, 2));
 
 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;
index 1eddf502dc7c41494a661c7a8bc75d438aba128b..a5daada149dba8aca6c8c2498f45ed80a5f16521 100644 (file)
@@ -214,7 +214,7 @@ ERROR:  invalid SRID: 999000 not found in spatial_ref_sys
 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 @@ ERROR:  invalid GML representation
 #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