Data are encapsulated in a single file, usually with the suffix .dgn.
Data Access / Connection Method¶
Access is available in MapServer through OGR.
The CONNECTIONTYPE OGR parameter must be used.
The path to the dgn file is required, file extension is needed.
All types of features in a DGN file are held in one «layer» of data. The layer is called elements and is the first and only layer.
The type of feature to be read from the DGN depends on the TYPE parameter in the map file.
DGN files typically contain POINT, LINE, POLYGON and ANNOTATION feature types.
DGN files contain «styling» information - how to color and present the data. This is used, optionally, by specifying the STYLEITEM «AUTO» parameter.
DGN files typically use white as a color for their features and therefore are not visible on maps with white backgrounds.
Using ogrinfo on a single DGN file:
> ogrinfo /data/dgn/0824t.dgn Had to open data source read-only. INFO: Open of `0842t.dgn' using driver `DGN' successful. 1: elements
No geometry/feature type for the layer is identified because it can be multiple types.
DGN files are not really GIS data files. They evolved from drafting formats used by computer aided drafting/design (CADD) programs.
They carry a few key attributes which are usually consistent across all DGN files. Most of the attributes relate to graphical styling of features for map presentation, such as ColorIndex, Style, etc.
Spatial reference system information is not always encoded into DGN files. This can be a major problem when trying to adequately reference the DGN data in another mapping program.
Measurement units can be a problem. In some cases the features could be located in kilometers or feet even though it is not obvious from the output of ogrinfo. Sometimes the only way to identify or correct a problem with units is to open the file in Microstation software.
Using ogrinfo to examine the structure of the file/layer:
> ogrinfo -summary /data/dgn/0824t.dgn elements INFO: Open of '0824t.dgn' using driver 'DGN' successful. Layer name: elements Geometry: Unknown (any) Feature Count: 22685 Extent: (-513183.050000, 150292.930000) - (-224583.220000, 407463.360000) Layer SRS WKT: (unknown) Type: Integer (2.0) Level: Integer (2.0) GraphicGroup: Integer (4.0) ColorIndex: Integer (3.0) Weight: Integer (2.0) Style: Integer (1.0) EntityNum: Integer (8.0) MSLink: Integer (10.0) Text: String (0.0)
Map File Example:
LAYER NAME dgn TYPE LINE STATUS DEFAULT CONNECTIONTYPE OGR CONNECTION "dgn/0824t.dgn" STYLEITEM "AUTO" CLASS END END # Layer