I have a table containing 3D geometry in a PostGIS 2.0 database (the geometry is of type LINESTRING Z).

I need to get the geometry out and into a DXF, DGN or 3D Shapefile. What is the easiest way to do this?

(I was sure I had achieved this via QGIS before, but it seems to remove the Z value and produce only a 2D file when attempting a 'Save As ...' from a PostGIS layer).

1 Answer 1


Note: this is an old answer, tests with current versions might reveal different results

GDAL is able to do this. The following command creates a 3D Shapefile:

ogr2ogr -f "ESRI Shapefile" "~/myshape" PG:"user={user} password={pass} dbname={dbname} host={host}" {table}

QGIS is not able to handle 3D geometries. I would be very surprised, if it would be able to transform 3D information from one format to another.


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.