Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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).

share|improve this question
up vote 1 down vote accepted

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.

share|improve this answer
    
Hello, I don't know why but this solution doesn't work for me. I have 2 GEOM columns (specified to ogr2ogr as -geomfield). 1st is type GEOMETRY(MULTILINESTRINGZ) and 2nd is GEOMETRY(LINESTRINGZ). They store same line made only from two points. I can't visualize none of them in ArcScene/ArcGlobe. They act as 2D. Should I specify CRS in data type? Should I add Z CRS somehow? Here is example of ST_AsText of these geometries... LINESTRING Z (2.17766 41.3885803 0,2.18333 41.3833 754) ..... MULTILINESTRING Z ((2.17766 41.3885803 0,2.18333 41.3833 754)) .... Thanks for advice and your time. – DavidK Jan 10 at 18:56
    
This is not related in any way to Arc* products' support to display 3D geometries. Is there evidence that it's the shapefiles' produced with ogr2ogr fault? If not, I'd recommend contacting your local support center or asking a new question. – Matthias Kuhn Jan 11 at 12:15

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.