Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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.

share|improve this question
add comment

1 Answer

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_SetSRID(
    ST_MakePoint(
        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.

share|improve this answer
5  
Hint: ST_Force_2D is more elegant –  Mike T Dec 12 '12 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 '12 at 0:51
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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