Skip to content

Commit b78065a

Browse files
committed
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 git-svn-id: http://svn.osgeo.org/postgis/trunk@14350 b70326c6-7e19-0410-871a-916f4a2858ee
1 parent faf9288 commit b78065a

File tree

5 files changed

+20
-24
lines changed

5 files changed

+20
-24
lines changed

postgis/geography_inout.c

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -598,17 +598,8 @@ Datum geography_from_geometry(PG_FUNCTION_ARGS)
598598
);
599599
}
600600

601-
/*
602-
** Serialize our lwgeom and set the geodetic flag so subsequent
603-
** functions do the right thing.
604-
*/
605-
lwgeom_set_geodetic(lwgeom, true);
606-
607-
/* Recalculate the boxes after re-setting the geodetic bit */
608-
lwgeom_drop_bbox(lwgeom);
609-
lwgeom_add_bbox(lwgeom);
610-
611-
g_ser = geography_serialize(lwgeom);
601+
602+
g_ser = gserialized_geography_from_lwgeom(lwgeom, -1);
612603

613604
/*
614605
** Replace the unaligned lwgeom with a new aligned one based on GSERIALIZED.

postgis/geography_measurement.c

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1084,17 +1084,7 @@ Datum geography_segmentize(PG_FUNCTION_ARGS)
10841084
/* Calculate the densified geometry */
10851085
lwgeom2 = lwgeom_segmentize_sphere(lwgeom1, max_seg_length);
10861086

1087-
/*
1088-
** Set the geodetic flag so subsequent
1089-
** functions to do the right thing.
1090-
*/
1091-
lwgeom_set_geodetic(lwgeom2, true);
1092-
1093-
/* Recalculate the boxes after re-setting the geodetic bit */
1094-
lwgeom_drop_bbox(lwgeom2);
1095-
lwgeom_add_bbox(lwgeom2);
1096-
1097-
g2 = geography_serialize(lwgeom2);
1087+
g2 = gserialized_geography_from_lwgeom(lwgeom2, -1);
10981088

10991089
/* Clean up */
11001090
lwgeom_free(lwgeom1);

regress/sfcgal/tickets_expected

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ ERROR: invalid SRID: 999000 not found in spatial_ref_sys
212212
NOTICE: SRID value -1 converted to the officially unknown SRID value 0
213213
#1596.6|public.road_pg.roads_geom SRID changed to 0
214214
#1596.7|0
215-
#1596|Point[BGS]
215+
#1596|Point[GS]
216216
#1695|MULTIPOLYGON EMPTY
217217
#1697.1|0
218218
#1697.2|0

regress/tickets.sql

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -913,5 +913,17 @@ SELECT '#3172', ST_AsText(ST_AddMeasure('LINESTRING(0 0,0 0)', 1, 2));
913913

914914
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));
915915

916+
SELECT '#3355', ST_Intersects(
917+
'LINESTRING(124.983539 1.419224,91.181596 29.647798)'::geography
918+
, ST_Segmentize('LINESTRING(124.983539 1.419224,91.181596 29.647798)'::geography, 47487290)::geography);
919+
920+
SELECT '#3356', ST_Summary(wkt::geometry) As wkt_geom,
921+
ST_Summary(wkt::geography) As wkt_geog,
922+
ST_Summary(wkt::geometry::geography) As geom_geog
923+
FROM (VALUES (
924+
'LINESTRING(124.983539 1.419224,91.181596 29.647798)'::text ),
925+
('LINESTRING(124.983539 1.419224,91.181596 29.647798, 91.28 29.647)'::text ) ) As f(wkt)
926+
ORDER BY wkt;
927+
916928
-- Clean up
917929
DELETE FROM spatial_ref_sys;

regress/tickets_expected

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ ERROR: invalid SRID: 999000 not found in spatial_ref_sys
214214
NOTICE: SRID value -1 converted to the officially unknown SRID value 0
215215
#1596.6|public.road_pg.roads_geom SRID changed to 0
216216
#1596.7|0
217-
#1596|Point[BGS]
217+
#1596|Point[GS]
218218
#1695|MULTIPOLYGON EMPTY
219219
#1697.1|0
220220
#1697.2|0
@@ -277,3 +277,6 @@ ERROR: invalid GML representation
277277
#2956|t
278278
#3172|LINESTRING M (0 0 1,0 0 2)
279279
#3300|POLYGON((-71.7821 42.2622,-71.7821 42.9067,-71.029 42.9067,-71.029 42.2622,-71.7821 42.2622))
280+
#3355|t
281+
#3356|LineString[] with 2 points|LineString[GS] with 2 points|LineString[GS] with 2 points
282+
#3356|LineString[B] with 3 points|LineString[BGS] with 3 points|LineString[BGS] with 3 points

0 commit comments

Comments
 (0)