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

Stephen Woodbridge woodbri at swoodbridge.com
Mon Jun 4 11:22:31 PDT 2012


Colin,

You might want to try reading the dxf file the the Teigha File 
Convertor. This is a Windows utility that converts between dwg abd dxf 
and the various versions of both. Its a free download and I just used it 
to convert about 60K dwg files to dxf and it works great. You can 
specify what version of dxf you are reading or writing. Oh and there is 
also a companion viewer application so you can view the files. I just 
found it a useful too because it was very flexible and supported 
multiple versions.

-Steve

On 6/4/2012 12:42 PM, Colin Wright wrote:
> 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
>
>
>
> _______________________________________________ gdal-dev mailing
> list gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev



More information about the gdal-dev mailing list