From: Darafei Praliaskouski Date: Thu, 22 Feb 2018 11:16:37 +0000 (+0000) Subject: Fix cast from box3d to geometry X-Git-Tag: 2.3.7~14 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3fe4bdcec1898b7705c3e5fb27ca97d512a0fd00;p=postgis Fix cast from box3d to geometry Patch by Matthias Bay Closes https://github.com/postgis/postgis/pull/214 Closes #4020 git-svn-id: http://svn.osgeo.org/postgis/branches/2.3@16407 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/NEWS b/NEWS index c7e42d0e8..41406f7a9 100644 --- a/NEWS +++ b/NEWS @@ -5,7 +5,8 @@ PostGIS 2.3.7dev - #3978, Fix KNN when upgrading from 2.1 or older (Sandro Santilli) - #4003, lwpoly_construct_circle: Avoid division by zero (Raúl Marín Rodríguez) - + - #4020, Casting from box3d to geometry now returns correctly connected + PolyhedralSurface (Matthias Bay) PostGIS 2.3.6 2018/01/17 diff --git a/postgis/lwgeom_box3d.c b/postgis/lwgeom_box3d.c index e67b4387c..fb701c588 100644 --- a/postgis/lwgeom_box3d.c +++ b/postgis/lwgeom_box3d.c @@ -328,10 +328,10 @@ Datum BOX3D_to_LWGEOM(PG_FUNCTION_ARGS) &points[0], &points[1], &points[2], &points[3])); /* add top polygon */ geoms[1] = lwpoly_as_lwgeom(lwpoly_construct_rectangle(LW_TRUE, LW_FALSE, - &points[4], &points[5], &points[6], &points[7])); + &points[4], &points[7], &points[6], &points[5])); /* add left polygon */ geoms[2] = lwpoly_as_lwgeom(lwpoly_construct_rectangle(LW_TRUE, LW_FALSE, - &points[0], &points[1], &points[5], &points[4])); + &points[0], &points[4], &points[5], &points[1])); /* add right polygon */ geoms[3] = lwpoly_as_lwgeom(lwpoly_construct_rectangle(LW_TRUE, LW_FALSE, &points[3], &points[2], &points[6], &points[7])); @@ -340,7 +340,7 @@ Datum BOX3D_to_LWGEOM(PG_FUNCTION_ARGS) &points[0], &points[3], &points[7], &points[4])); /* add front polygon */ geoms[5] = lwpoly_as_lwgeom(lwpoly_construct_rectangle(LW_TRUE, LW_FALSE, - &points[1], &points[2], &points[6], &points[5])); + &points[1], &points[5], &points[6], &points[2])); geom = (LWGEOM *) lwcollection_construct(POLYHEDRALSURFACETYPE, SRID_UNKNOWN, NULL, ngeoms, geoms); diff --git a/regress/regress_expected b/regress/regress_expected index bf70ddf7b..e1c8c6ef6 100644 --- a/regress/regress_expected +++ b/regress/regress_expected @@ -92,7 +92,7 @@ ERROR: parse error - invalid geometry at character 23 107c|POLYGON((2 3 5,2 8 5,6 8 5,6 3 5,2 3 5)) 107d|POLYGON((1 -1 4,2 -1 4,2 -1 9,1 -1 9,1 -1 4)) 107e|POLYGON((-1 3 5,-1 6 5,-1 6 8,-1 3 8,-1 3 5)) -107f|POLYHEDRALSURFACE(((1 2 3,1 5 3,4 5 3,4 2 3,1 2 3)),((1 2 6,1 5 6,4 5 6,4 2 6,1 2 6)),((1 2 3,1 5 3,1 5 6,1 2 6,1 2 3)),((4 2 3,4 5 3,4 5 6,4 2 6,4 2 3)),((1 2 3,4 2 3,4 2 6,1 2 6,1 2 3)),((1 5 3,4 5 3,4 5 6,1 5 6,1 5 3))) +107f|POLYHEDRALSURFACE(((1 2 3,1 5 3,4 5 3,4 2 3,1 2 3)),((1 2 6,4 2 6,4 5 6,1 5 6,1 2 6)),((1 2 3,1 2 6,1 5 6,1 5 3,1 2 3)),((4 2 3,4 5 3,4 5 6,4 2 6,4 2 3)),((1 2 3,4 2 3,4 2 6,1 2 6,1 2 3)),((1 5 3,1 5 6,4 5 6,4 5 3,1 5 3))) 108|2 109|4 110|6 diff --git a/regress/sfcgal/regress_expected b/regress/sfcgal/regress_expected index d0844e4c7..a61416720 100644 --- a/regress/sfcgal/regress_expected +++ b/regress/sfcgal/regress_expected @@ -121,7 +121,7 @@ ERROR: parse error - invalid geometry at character 23 107c|POLYGON((2 3 5,2 8 5,6 8 5,6 3 5,2 3 5)) 107d|POLYGON((1 -1 4,2 -1 4,2 -1 9,1 -1 9,1 -1 4)) 107e|POLYGON((-1 3 5,-1 6 5,-1 6 8,-1 3 8,-1 3 5)) -107f|POLYHEDRALSURFACE(((1 2 3,1 5 3,4 5 3,4 2 3,1 2 3)),((1 2 6,1 5 6,4 5 6,4 2 6,1 2 6)),((1 2 3,1 5 3,1 5 6,1 2 6,1 2 3)),((4 2 3,4 5 3,4 5 6,4 2 6,4 2 3)),((1 2 3,4 2 3,4 2 6,1 2 6,1 2 3)),((1 5 3,4 5 3,4 5 6,1 5 6,1 5 3))) +107f|POLYHEDRALSURFACE(((1 2 3,1 5 3,4 5 3,4 2 3,1 2 3)),((1 2 6,4 2 6,4 5 6,1 5 6,1 2 6)),((1 2 3,1 2 6,1 5 6,1 5 3,1 2 3)),((4 2 3,4 5 3,4 5 6,4 2 6,4 2 3)),((1 2 3,4 2 3,4 2 6,1 2 6,1 2 3)),((1 5 3,1 5 6,4 5 6,4 5 3,1 5 3))) 108|2 109|4 110|6