M.App Enterprise Discussions

Discuss topics with other M.App Enterprise Product pioneers and experts to get the most out of it.
Showing results for 
Search instead for 
Do you mean 
Reply
Highlighted
Occasional Contributor
Posts: 15
Registered: ‎02-27-2019

Geometry has Z dimension but column does not‎

Hello everybody,


I have a question about the geometry type. Does anyone know how I can create the geometry type in the Postgis database without a Z dimension? When I create a new table that does not contain any data, it is displayed as geometry and not as a polygon as I defined it.

geometrietyp.PNG

 

CREATE TABLE public.verpachtung
(
gemarkungflur character varying(40) COLLATE pg_catalog."default",
flskz character varying(255) COLLATE pg_catalog."default",
paechter character varying(255) COLLATE pg_catalog."default",
groesse_pacht double precision,
pacht_ab timestamp without time zone,
lage character varying(255) COLLATE pg_catalog."default",
namen character varying(255) COLLATE pg_catalog."default",
f10 character varying(255) COLLATE pg_catalog."default",
id1 character varying(36) COLLATE pg_catalog."default" NOT NULL,
geometrie geometry(Polygon,25832),
datei bytea,
dateiname character varying(100) COLLATE pg_catalog."default",
dateityp character varying(100) COLLATE pg_catalog."default",
CONSTRAINT verpachtung_pkey PRIMARY KEY (id1)
)
WITH (
OIDS = FALSE
)
TABLESPACE pg_default;

ALTER TABLE public.verpachtung
OWNER to bb;

 

 

An error then occurs in the desktop app when creating a new object. Log file is attached.

 

 

Thanks

Melissa

Highlighted
Technical Evangelist
Posts: 808
Registered: ‎11-12-2015

Re: Geometry has Z dimension but column does not‎

Hi mdeibler,

 

I believe instead you need to consider the database type goemetry to be 'GeometryZ'.

The error is coming from the Postgres dataserver.
For me in my Postgis data I only have 'GeometryZ' and with that I have no issues between the workflow insertion of features and the backend database.
The error is a common Postgis error and of course means there a mismatch between insert feature and geometry column 2D vs 3D. Resolving it on the database is the key and you may find searching the Postgis documentation useful in that regard.

 

Highlighted
Occasional Contributor
Posts: 15
Registered: ‎02-27-2019

Re: Geometry has Z dimension but column does not‎

Hi sclow,

 

thank you for your tip. If I add this to my table it works:

ALTER TABLE public.verpachtung ALTER COLUMN geometrie SET DATA TYPE geometry(POLYGONZ,25832) USING ST_Force_3D(geometrie);

 

Now I can create an object, but then I cannot edit the geometry of that object. So I get another error message: 'An object has to implement IConvertible'. Log file is attached.

 

Do you know what that could be?

 

Thanks

Melissa

Highlighted
Technical Evangelist
Posts: 808
Registered: ‎11-12-2015

Re: Geometry has Z dimension but column does not‎

Hi Melissa,

 

I am not familiar with that new error message and I dont see past reports of the same error.

I wonder if someone else may chime in on this.

 

Perhaps it would be helpful to monitor the PostGIS database and capture the statements being issued there during the edit.

It suggests a cast is being attempted and I believe it is likely to do with the Geometry type, but I'm not certain given this log file.