ST_Force2D on 3D geometries

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

ST_Force2D on 3D geometries

Hubel, Andreas
Hi,

is the following expected behaviour?

SELECT ST_ASText(ST_Force2D('BOX3D(80 -65 -1, 81 -72 5)'::box3d));

"POLYHEDRALSURFACE(((80 -72,80 -65,81 -65,81 -72,80 -72)),((80 -72,80 -65,81 -65,81 -72,80 -72)),((80 -72,80 -65,80 -65,80 -72,80 -72)),((81 -72,81 -65,81 -65,81 -72,81 -72)),((80 -72,81 -72,81 -72,80 -72,80 -72)),((80 -65,81 -65,81 -65,80 -65,80 -65)))"


To get the result I expected, I had to use following query:

SELECT Box2d(ST_Force2D('BOX3D(80 -65 -1, 81 -72 5)'::box3d));

"BOX(80 -72,81 -65)"

Which only works in this case, as the input is a BOX3D.

Is there a function which converts a POLYHEDRALSURFACE to POLYGON?


Thanks in advance,
Andreas

_______________________________________________
postgis-users mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/postgis-users

signature.asc (465 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: ST_Force2D on 3D geometries

Regina Obe-2
Andreas,

Yes that is expected new behavior.  I think since PostGIS 2.3 when we
changed BOX3D to cast to PolyhedralSurface.

As far as converting a Polyhedralsurface to a Polygon, I'm not sure this is
what you are looking for, but

http://postgis.net/docs/manual-2.3/ST_Dump.html

will return all the patches (faces) of a polyhedralsurface as a set of
polygons. Usually polygon z.

So I'm guessing you are looking for behavior something like this:

SELECT ST_AsText(ST_Union(ST_Force2D(geom)))
FROM ST_Dump('BOX3D(80 -65 -1, 81 -72 5)'::box3d::geometry) AS g(path,geom);


Then again if you only care about the bounding box 2d geometry, you can
always apply to any geometry even polyhedral like so:

SELECT geom::box2d::geometry

Hope that helps,
Regina

http://postgis.us
http://postgis.net



-----Original Message-----
From: postgis-users [mailto:[hidden email]] On Behalf
Of Hubel, Andreas
Sent: Tuesday, June 06, 2017 5:17 PM
To: [hidden email]
Subject: [postgis-users] ST_Force2D on 3D geometries

Hi,

is the following expected behaviour?

SELECT ST_ASText(ST_Force2D('BOX3D(80 -65 -1, 81 -72 5)'::box3d));

"POLYHEDRALSURFACE(((80 -72,80 -65,81 -65,81 -72,80 -72)),((80 -72,80 -65,81
-65,81 -72,80 -72)),((80 -72,80 -65,80 -65,80 -72,80 -72)),((81 -72,81
-65,81 -65,81 -72,81 -72)),((80 -72,81 -72,81 -72,80 -72,80 -72)),((80
-65,81 -65,81 -65,80 -65,80 -65)))"


To get the result I expected, I had to use following query:

SELECT Box2d(ST_Force2D('BOX3D(80 -65 -1, 81 -72 5)'::box3d));

"BOX(80 -72,81 -65)"

Which only works in this case, as the input is a BOX3D.

Is there a function which converts a POLYHEDRALSURFACE to POLYGON?


Thanks in advance,
Andreas

_______________________________________________
postgis-users mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/postgis-users
Loading...