AutoCAD .dxf format is a CAD format that may be encountered in GIS.  The format is a classic choice for CAD work but is a very poor choice for 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.   When exporting, .prj and .mapmeta files are written.  Exporting labels to DXF writes a text height tag to make exported files readable in various versions of AutoCAD.  See the Exporting topic.


An individual .dxf file can contain many vector layers, which will be imported as many drawings into the Manifold product, as well as text layers, which will be imported as labels, with the drawings underlying those labels also automatically created.  A map will automatically be created with all the drawings and labels as layers in the map.


After importing data from .dxf we must manually specify the coordinate system by using the Assign Initial Coordinate System dialog.    If we are lucky, the source from which we obtained the .dxf will have provided some documentation telling us what coordinate system we must manually specify.  If we are unlucky, we will have to guess at the coordinate system or, if we cannot guess successfully, undertake a tedious process of manual georeferencing.  If many drawings and labels are created by importing a .dxf, once we georeference one of the drawings we save the coordinate system that works as a Favorite, and then easily apply it to all the other drawings and labels also imported from that .dxf.


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. In the dropdown menu, choose More... to launch the New Data Source dialog.

  3. Choose File: dxf as the Type.

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

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

  6. Press Create Data Source

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

  8. 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.


In the main menu, choose File - Create - New Data Source.   The dropdown menu provides a list of favorites to choose from as well as a More... option.  



Choose More... to launch the New Data Source dialog.



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.




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 tab of the Info pane to specify the intended projection.  


When exporting, .prj and .mapmeta files are written.  See the Exporting topic.



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.


Z values - Any Z values for objects in the DXF will be imported into the object's geometry in Manifold as a Z coordinate, not as a Z attribute field in the table.  We can extract Z values from an object's geometry using the GeomCoordXYZ SQL function, using expressions such as




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





Example: Import AutoCAD DWG and Georeference - Neither AutoCAD DXF nor AutoCAD DWG format provide coordinate system information.  This example shows a typical case where documentation provided on the web site from which we have downloaded a DWG allows us to quickly and simply georeference the imported drawing.


Example: Import AutoCAD DXF and Georeference - Neither AutoCAD DXF nor AutoCAD DWG format provide coordinate system information.  This example shows a typical case where we import a DXF using an unknown coordinate system, but based on a lucky guess we accurately georeference the imported drawing.