[Gdal-dev] SHP <-> DGN
Frank Warmerdam
warmerdam at pobox.com
Mon Oct 31 10:44:49 EST 2005
On 10/31/05, Mateusz Łoskot <mateusz at loskot.net> wrote:
> Thanks Frank,
>
> But it seems I'm doing something wrong. I tried to convert file from
> dgnsamp.zip dateset downloaded from the dgnlib site
> (http://dgnlib.maptools.org/) and here is what I get:
>
> mloskot at dog:~/download/dgn$ ogr2ogr -f "ESRI Shapefile" samp4.shp samp4.dgn
>
> ERROR 1: Attempt to write non-linestring (POINT) geometry to ARC type
> shapefile.ERROR 1: Terminating translation prematurely after failed
> translation of layer elements
>
> Am I misusing ogr2ogr?
Mateusz,
Ah, your original email was not clear on the direction you wanted to
translate. DGN files have all features in one layer, and that layer
will generally have a mixture of geometry types. Shapefiles only
allow one geometry type per file (point, line or polygon). You
will likely need to translate this to distinct files something like:
ogr2ogr -nlt POINT -skipfailures -f "ESRI Shapefile" samp4_pnt.shp samp4.dgn
ogr2ogr -nlt LINESTRING -skipfailures -f "ESRI Shapefile"
samp4_lne.shp samp4.dgn
ogr2ogr -nlt POLYGON -skipfailures -f "ESRI Shapefile" samp4_pol.shp samp4.dgn
You will still get error messages about untranslated geometries, but between
the three files you should have everything.
Best regards,
--
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush | Geospatial Programmer for Rent
More information about the Gdal-dev
mailing list