[gdal-dev] Can't convert .dgn file to shape file by using ogr2ogr

Even Rouault even.rouault at mines-paris.org
Thu Jul 12 01:53:12 PDT 2012

Selon taibc <taibc_coltech at yahoo.com>:

> Dear friends,
> I tried to convert .dgn file to shape files by using ogr2ogr with FWTools
> Shell as below:

FWTools is quite ancient by current standards. You could upgrade to a newer
binary distribution. See http://trac.osgeo.org/gdal/wiki/DownloadingGdalBinaries

> ogr2ogr -f "ESRI Shapefile" Dc16.shp Dc16.dgn
> but I got an bellow error:
> /Warning 6: Normalized/laundered field name: 'GraphicGroup' to 'GraphicGro'

Nothing alarming. Shapefiles do not accept attribute name longer than 10
characters. ogr2ogr should deal with the truncation just fine.

> ERROR 1: Attempt to write non-linestring (POINT) geometry to ARC type
> shapefile.

This one is actually the error. DGN files can have a mix of geometry types
(points, lines, etc...), which is not supported by shapefiles. So you have to a
filtering to make sure that the target shapefile only receive geometries of the
right type.

ogr2ogr Dc16_points.shp Dc16.dgn -where "OGR_GEOMETRY = 'POINT'" -nln

ogr2ogr Dc16_lines.shp Dc16.dgn -where "OGR_GEOMETRY = 'LINESTRING'" -nln

ogr2ogr Dc16_polygons.shp Dc16.dgn -where "OGR_GEOMETRY = 'POLYGON'" -nln

More information about the gdal-dev mailing list