I am unable to store a polyhedralsurface object in my POSTGIS database.
My table has two columns:
name character varying,
geom geometry(POLYHEDRALSURFACE)
I am trying to insert the following geometry:
INSERT INTO public.geometries(
name, geom)
VALUES ('Cube', ST_GeomFromEWKT('SRID=4326;POLYHEDRALSURFACE(
((0 0 0, 0 0 1, 0 1 1, 0 1 0, 0 0 0)),
((0 0 0, 0 1 0, 1 1 0, 1 0 0, 0 0 0)),
((0 0 0, 1 0 0, 1 0 1, 0 0 1, 0 0 0)),
((1 1 0, 1 1 1, 1 0 1, 1 0 0, 1 1 0)),
((0 1 0, 0 1 1, 1 1 1, 1 1 0, 0 1 0)),
((0 0 1, 1 0 1, 1 1 1, 0 1 1, 0 0 1))
)'));
but POSTGIS throws an error:
Geometry has Z dimension but column does not
Best Answer
Found solution :D
You can either set your geometry as GeometryZ at time of creation like this
Or use AddGeometryColumn function
If anyone has a better solution, please comment. Thanks!