[postgis-tickets] r14834 - #3522, handle POINT and MULTIPOINT correctly in ST_Subdivide
Paul Ramsey
pramsey at cleverelephant.ca
Tue Apr 12 14:39:24 PDT 2016
Author: pramsey
Date: 2016-04-12 14:39:24 -0700 (Tue, 12 Apr 2016)
New Revision: 14834
Modified:
branches/2.2/NEWS
branches/2.2/liblwgeom/cunit/cu_clip_by_rect.c
branches/2.2/liblwgeom/lwgeom.c
branches/2.2/regress/tickets.sql
branches/2.2/regress/tickets_expected
Log:
#3522, handle POINT and MULTIPOINT correctly in ST_Subdivide
Modified: branches/2.2/NEWS
===================================================================
--- branches/2.2/NEWS 2016-04-12 21:37:50 UTC (rev 14833)
+++ branches/2.2/NEWS 2016-04-12 21:39:24 UTC (rev 14834)
@@ -5,6 +5,7 @@
- #3524, Add interruptibility to geography brute-force distance
calculation
+ - #3522, Handle POINT and MULTIPOINT correctly in ST_Subdivide
PostGIS 2.2.2
Modified: branches/2.2/liblwgeom/cunit/cu_clip_by_rect.c
===================================================================
--- branches/2.2/liblwgeom/cunit/cu_clip_by_rect.c 2016-04-12 21:37:50 UTC (rev 14833)
+++ branches/2.2/liblwgeom/cunit/cu_clip_by_rect.c 2016-04-12 21:39:24 UTC (rev 14834)
@@ -42,7 +42,23 @@
CU_ASSERT_STRING_EQUAL(wkt, tmp)
lwfree(tmp); lwgeom_free(out); lwgeom_free(in);
- /* Disjoint polygon */
+ wkt = "MULTIPOINT EMPTY";
+ in = lwgeom_from_wkt(wkt, LW_PARSER_CHECK_NONE);
+ out = lwgeom_clip_by_rect(in, 5, 0, 10, 10);
+ tmp = lwgeom_to_ewkt(out);
+ /* printf("%s\n", tmp); */
+ CU_ASSERT_STRING_EQUAL(wkt, tmp)
+ lwfree(tmp); lwgeom_free(out); lwgeom_free(in);
+
+ wkt = "MULTIPOINT(0 0, 6 6, 7 5)";
+ in = lwgeom_from_wkt(wkt, LW_PARSER_CHECK_NONE);
+ out = lwgeom_clip_by_rect(in, 5, 0, 10, 10);
+ tmp = lwgeom_to_ewkt(out);
+ /* printf("%s\n", tmp); */
+ CU_ASSERT_STRING_EQUAL("MULTIPOINT(6 6,7 5)", tmp)
+ lwfree(tmp); lwgeom_free(out); lwgeom_free(in);
+
+ /* Disjoint polygon */
wkt = "POLYGON((311017 4773762,311016 4773749,311006 4773744,310990 4773748,310980 4773758,310985 4773771,311003 4773776,311017 4773762))";
in = lwgeom_from_wkt(wkt, LW_PARSER_CHECK_NONE);
out = lwgeom_clip_by_rect(in, -80, -80, 80, 80);
Modified: branches/2.2/liblwgeom/lwgeom.c
===================================================================
--- branches/2.2/liblwgeom/lwgeom.c 2016-04-12 21:37:50 UTC (rev 14833)
+++ branches/2.2/liblwgeom/lwgeom.c 2016-04-12 21:39:24 UTC (rev 14834)
@@ -1912,10 +1912,20 @@
}
if ( width == 0.0 && height == 0.0 )
- return 0;
+ {
+ if ( geom->type == POINTTYPE )
+ {
+ lwcollection_add_lwgeom(col, lwgeom_clone_deep(geom));
+ return 1;
+ }
+ else
+ {
+ return 0;
+ }
+ }
/* Always just recurse into collections */
- if ( lwgeom_is_collection(geom) )
+ if ( lwgeom_is_collection(geom) && geom->type != MULTIPOINTTYPE )
{
LWCOLLECTION *incol = (LWCOLLECTION*)geom;
int n = 0;
Modified: branches/2.2/regress/tickets.sql
===================================================================
--- branches/2.2/regress/tickets.sql 2016-04-12 21:37:50 UTC (rev 14833)
+++ branches/2.2/regress/tickets.sql 2016-04-12 21:39:24 UTC (rev 14834)
@@ -933,6 +933,7 @@
UNION ALL
SELECT '#3437e' AS t, count(*) FROM mp INNER JOIN p ON ST_Within(p.geom, mp.geom);
+SELECT '#3522', ST_AsText(ST_Subdivide(ST_GeomFromText('POINT(1 1)',4326),10));
-- Clean up
DELETE FROM spatial_ref_sys;
Modified: branches/2.2/regress/tickets_expected
===================================================================
--- branches/2.2/regress/tickets_expected 2016-04-12 21:37:50 UTC (rev 14833)
+++ branches/2.2/regress/tickets_expected 2016-04-12 21:39:24 UTC (rev 14834)
@@ -285,3 +285,4 @@
#3437c|5
#3437d|5
#3437e|5
+#3522|POINT(1 1)
More information about the postgis-tickets
mailing list