Sunday 24 March 2019

3d - DXF attribute to z value


We have been given a DXF that contains a Elevation attribute but we would like to generate a 3D DXF. I know I can generate a 3D dxf from a shapefile using:



ogr2ogr -f "DXF" out.dxf in.shp -zfield Elev

But the ogr driver doesn't seem to pick up the attributes as fields in the dxf.


Does anyone know if this is possible.


I would like a free solution if possible. We do have FME but I'm looking around for other options.



Answer



I have been trying to find a way of doing this for months. In the end, the only method I could find was to load the DXF into gvSIG and export it as a shapefile. Doing this adds the linestring z-value to the shapefile's DBF as an attribute.


In my case, the DXFs were OS OpenData containing contours, along with other data that I did not require, so I extracted just the contours to a new DXF before loading the file into gvSIG:


ogr2ogr -f DXF contours.dxf -where "LAYER='G8040201'" original.dxf

No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...