[gdal-dev] Problems converting polygons to DXF with ogr2ogr

Colin Wright wrightc at forthvalleygis.co.uk
Mon Jun 4 09:42:50 PDT 2012


With gdal 1.8 and 1.9 I am unable to convert any polygon datasets to DXF in a format where they can be read by AutoCad.  Every time I try to open a DXF created with these versions I get the error:

The following error was encountered while reading
in HATCH starting at line 1546:
Error: expected group code 10
Invalid or incomplete DXF input -- drawing discarded.

I've found a couple of mentions of this issue on the mailing list in the past but haven't seen any real solutions.  Details are below:

I am currently using 1.9.0, and have tried converting programmatically from postgis 1.5.3 -> DXF  and   have also tried using ogr2ogr from Shapefile -> DXF with the same result.
The OGR2OGR command lines I've tried are:

ogr2ogr -f "DXF" polytest2.dxf polytest.shp
or 
ogr2ogr -f "DXF" -nlt POLYGON polytest2.dxf polytest.shp

The test shapefile contains only 3 simple polygon shapes with no holes or multi-part geometries, and as far as I can tell I'm using the standard DXF header and footer files that come with GDAL.  The DXFs work fine when created with the older 1.7 version of GDAL which just translates the polygons as lines.

Does anyone know of another approach I can try, or is this a known bug?  I can send anyone a sample dxf file if they would like to take a look at it.

Regards

Colin Wright





More information about the gdal-dev mailing list