AutoCAD .dxf format is a CAD format that is frequently encountered in GIS. The format is a a classic choice for CAD work but must be imported with care in GIS work since it saves neither database information nor projection settings. Not surprisingly, .dxf format is used mostly to save CAD work such as diagrams of facilities and other CAD drawings created without any sense of projection or geographic location.  After importing data we must manually specify the coordinate system by using the Assign Initial Coordinate System dialog.


AutoCAD .dxf format has not been published by AutoCAD and thus any ability to read .dxf files comes from overall community experience and guesswork.  While not all .dxf files or all features they contain may be successfully read, in most cases remarkably good imports are possible.

New Data Source Dialog

A quick way to import a .dxf file into a project is to use File - Import.   For better control over the resulting import, most Manifold users will import a .dxf using File - Create - New Data Source, since the  New Data Source dialog provides a Merge layers option.


.dxf drawings will often include layers.  Each layer will be imported into Manifold as a separate drawing so that they can appear within a map as layers. A map component containing all the layers will also be created.   Some .dxf files may contain a bewildering number of layers that are best organized within a single drawing.   Checking the Merge layers option box in the New Data Source dialog will create a single drawing that contains all such layers


To import from DXF format:


  1. Choose File - Create - New Data Source from the main menu.

  2. Choose File: dxf as the Type.

  3. In the Source box, use the [...] browse button to find and to open the .dxf file desired.

  4. Check the Merge layers box if desired (almost always).

  5. Press Create Data Source

  6. Expand the new data source hierarchy, highlight the linked components within, and choose Copy.

  7. Click into a blank part of the project outside of the data source hierarchy and choose Paste.





Name for the new data source, "Data Source" by default.  Specify a more  memorable name as desired.


Choose File: dxf to connect to a .dxf file.


The path to the .dxf file.  Use the [...] browse button to navigate to, and to open the desired .dxf file.

[...] Browse button

Click to populate the Source box.  Browse the Windows file system to locate and open the desired file using a Select File dialog modeled on the standard Windows File - Open dialog.  The type of file will be pre-loaded into the dialog depending on what was selected in the Type box

Open as read-only

Open the data source read-only.  Not checked by default so that if we want to open a .dxf file read/write we can do so.   .dxf format will lock out other users if we connect to a .dxf file read/write.  Therefore, if we would like to allow other users to be able to simultaneously connect to this same .dxf file and we do not need to write to it, we can check this box.  We can also check the read-only box if we would like to protect against accidental changes to the  .dxf file

Cache data

Create and utilize an accessory .MAPCACHE file for improved performance. Checked by default.

Save cached data between sessions

Save the cached data for the next time this project is opened, either within the .MAPCACHE file or within the .map project itself within a Cache subfolder within the System Data hierarchy.  Not checked, and not recommended for .dxf.

Cache only data that is expensive to compute dynamically

If there is significant overhead in computing data to be displayed, cache the results.  Uncheck this option.

Merge layers

Bring data from all layers within the .dxf into a single drawing and table. Add a field for each record in the table giving the name of the original layer.   Most Manifold users will check this option, since it is usually easier to manipulate data within a single drawing in tasks such as styling the data than it is to work with a large number of layers (the usual case with .dxf files).

Create Data Source

Create the new data source in the project pane and close the dialog.

Edit Query

Launch the Command Window loaded with a query that creates the data source using the given settings.  A great way to learn how to use SQL to create data sources.


 Exit the dialog without doing anything.


We will import a .dxf that shows the layout for a theater.




Launch File - Create - New Data Source.  Enter Flynn Center as the name and for the Type choose File: dxf.  No need to cache, so we uncheck the sub-boxes under Cache data.   This particular .dxf uses a spectacularly messy set of layers, so we will check the Merge layers box to consolidate those many layers into a single drawing.  Click the [...] browse button




In the Select File dialog, navigate to the desired .dxf file, click on it, and choose Open.




Press Create Data Source.


eg_import_dxf01_04.png  eg_import_dxf01_05.png


In the Project pane we expand the new Flynn Center data source and we ctrl-click on the four components within to highlight them.   We press Ctrl-C to copy them.   We click into an empty part of the Project pane outside of the data source hierarchy and press Ctrl-V to paste.    We can now click on the Flynn Center data source and choose Delete to delete it.




What we have just done is to link to the .dxf file and to then copy the data in it and paste that into the local .map project.   That is the same as using File - Import, except that we accomplished the import using the New Data Source dialog that gave us the option of merging many sparse layers within the .dxf into a single drawing that is much easier to work with.


We double-click the Map component to open it.




The result is a typical CAD drawing, with a labels layer above, that is brought in from a .dxf.      We can clean it up using various Manifold facilities.  


We color the drawing layer with lighter colors using Style and then we choose yellow color for the labels to make them more visible.   We use the Layers pane to set a background color of black.   We use transparent color for points, to avoid having to think about which of them have data for labels and which are just leftover from CAD and not used in GIS.




The result is a much more comprehensible display, as seen above.    The formatting used for the drawing is shown below.




The Layer field in the table specifies the name of the layer from which a particular object was imported.  We can use that in a thematic format to color each object by the layer from which it originated, which usually results in a comprehensible display.   We have applied the CB Paired palette, using a method of unique values.


We have also set the foreground color for points to transparent color, which has the effect of making any points that are left in the drawing disappear.  Some  points are used as anchor locations for labels, but there is no need to show a point icon at the location to which the label is anchored.




DXF files do not provide projection information.   They are CAD files, not geospatial files and thus are a really poor choice for the publication of spatial data.  In the above example we simply choose Pseudo-Mercator as the projection, since the drawing shown is not a geospatial drawing but simply a blueprint.


Assume that projection information will not be captured when importing a DXF.  We should try to find any information that accompanied a DXF file that may describe the intended projection so we can launch Assign Initial Coordinate System in the Component pane to specify the intended projection.  



Block names - Reading DWG and DXF files creates a field for block names. If an object belongs to a sequence of nested blocks, the system uses the name of the top-level block.


HATCH objects - Reading a DXF file reads HATCH objects as areas and avoids creating separate objects for area boundaries.  Exporting a drawing to a DXF file exports areas as hatches instead of exporting area boundaries as lines.


DXF Import Options - DXF is thinly documented and can include format variations that are not at all documented. Although the Manifold .dxf dataport works surprisingly well across a wide range of .dxf files it is always possible that a .dxf may be encountered that cannot be imported.


An option in such cases is to use Manifold's GDAL/OGR dataport to attempt to import the .dxf through GDAL using the File - Import command.   GDAL imports all layers merged together, but does not build a separate labels layer for text.   Differences in how different packages import a .dxf are very common, so having two options to import .dxf within Manifold can provide a second chance to extract all possible from a quirky .dxf.  


The Flynn Center - The Flynn Center for the Performing Arts is located in Burlington, Vermont, in the United States.


See Also