I have to define a geometry column in PostGIS for 2D points, but when I try to import points from DXF to postgres I get the following message:

"postgis error: when adding features geometry has z dimension but column does not"

Is there any way to change DXF files to be 2D geometry? I have tried this with the comand Flatten in autocad but the same error appears.

2 Answers 2


There may be a more elegant solution, but can you import the points as 3-D points, and then create a 2-D point in Postgres? For example ST_X( 3dpoint ) and ST_Y( 3dpoint ) would give you the x and y coordinates so you could then create a point using:

        ST_X( 3dpoint ), ST_Y( 3dpoint )
                 ), 900913) 

I don't know what form your initial data is in, so perhaps you can just use the x and y values by themselves.

  • 9
    Hint: ST_Force_2D is more elegant
    – Mike T
    Dec 12, 2012 at 0:35
  • Thanks - I was unaware of it. Happy to add it to my answer unless you'd prefer to answer yourself......
    – djq
    Dec 12, 2012 at 0:51

DXF export only the rows and then copy and paste the features as a new vector layer

  • Your answer has been flagged because of its length. Can you elaborate more on how this answers the question?
    – Paul
    Jul 15, 2014 at 17:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.