How do I get rid of the Z dimension in PostGIS?
Specifically, I have some MultiPolygonZ
s that I want to copy into another table as MultiPolygon
s. I don't care about the Z values - it's okay to just throw them away.
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It only takes a minute to sign up.
Sign up to join this communityYou should be able to do this with ST_Force2D
This is the example from the manual:
SELECT ST_AsEWKT(ST_Force2D('POLYGON((0 0 2,0 5 2,5 0 2,0 0 2),(1 1 2,3 1 2,1 3 2,1 1 2))'));
st_asewkt
----------------------------------------------
POLYGON((0 0,0 5,5 0,0 0),(1 1,3 1,1 3,1 1))
It might be possible to use a CAST operator as well (depending on some implicit, not well documented rules), but I'd go with the function on this.