This question already has an answer here:

This may see like a stupid question, but I'm new to QGIS, so please bear with me.

I'm having a problem when saving as .dxf. I export a building layer (polygons) as a .dxf file However in AutoCAD it turns up as a hatch instead of as a closed polyline which is what I'm looking for. I can of course recreate the boundary in AutoCAD, but I would rather just save the data correctly in QGIS.

Can anyone help?

thank you in advance & best regards Martin

marked as duplicate by Mapperz May 15 '15 at 17:45

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    I had the same problems, but with buildings in a polygon layer. Using vector -> geometry tools -> from polygons to lines (Using italian version, don't know if this is the exact translation) and saving the new layer as DXF solved the problem. Not much of a help if yours is a line layer already (or maybe what you call closed polylines are in fact polygons?) – sanzoghenzo Oct 22 '13 at 9:42
  • Thanks for the answer. You're right - the issue is with polygons and not polylines. You solution almost worked, but the result was grouped seperate lines in AutoCAD in stead of the closed polylines, which is what I'm looking for. – Martin Oct 22 '13 at 10:54
  • Strange, using this method and opening the dxf in draftsight I get polylines (non-closed polylines). You can always use the pedit command to convert lines to polylines, join and close them all at once. – sanzoghenzo Oct 23 '13 at 13:57
  • You're right, and your answer was very useful. Now I'm just wondering if QGIS can export closed polylined instead of non-closed. I'm nitpicking I know :) – Martin Oct 23 '13 at 15:06
  • Covered in this question: gis.stackexchange.com/questions/80293/… – Scro May 15 '15 at 17:13

Qgis uses GDAL's ogr2ogr to export between formats and from www.gdal.org, "Polygon and MultiPolygon features are written as HATCH entities", so the hatches in AutoCAD should be expected. To generate closed polylines from the hatch objects use the AutoCAD command HATCHGENERATEBOUNDARY.

Additionally you could use the command OGR2OGR to export the shapefile to polylines using the following code:

"C:\OSGeo4W64\bin\ogr2ogr.exe" -f "DXF" file.dxf shapefile.shp -nlt MULTILINESTRING

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