QlikMapsQlikMapsGeocoding and Custom Polygons QGISUsing .dxf files for Indoor Mapping

Using .dxf files for Indoor Mapping

DXF files can often be exported from CAD programs. They provide the layout of the inside of buildings or office park.

One of the issues with DXF files is that they are not built with lat/lng coordinates in mind. Since QlikMaps places all shapes on a map, we must first assign lat/lng coordinates to the DXF shapes. This is called georeferencing.

Below we will walk through the steps to georeference shapes found in DXF files using a free tool called QGIS.

I used the following software in this example:

QGIS 2.14.1

QGIS Plugin

  • Numeric Digitizer
  • Vector Bender
  • Polyline Encoder Exporter


Import DXF file

Import DXF file

Before working with DXF files we must first import them in to QGIS.


  1. Go to Vector-->DXF2SHP
  2. Select the DXF file in the Input DXF file box
  3. Select an Output File
  4. Select Polyline for Output File Type

It is also possible to drag the DXF file in to the layer window in QGIS. If this is done though, you must save the DXF file as a .shp file and re-import the .shp file.

Create a Points Layer

The Points layer will serve as the way to map the non georeferenced DXF file to real lat/lng points on a map.

Find Points

First, you will need to identify the points that represent the corners of the area in the DXF file on a map.

If you don't have the coordinates, go to Google Maps and locate the area represented by the DXF shape. Click on the corners of the area to have Google provide you with the lat/lng.

Place points layer in QGIS

Place points layer in QGIS

The points can then be imported in to the map by placing them in a csv and importing the csv as a layer.

Another option is to use the 'Numerical Digitizer' plugin. This plugin allows you to place points directly on a scratch layer.

  1. Create a new layer by going to Layer-->Create Layer-->New Temporary Scratch Layer
  2. The Scratch Layer should be set a Point type layer with EPSG:4326, WGS84 as the selected CRS
  3. With the new layer selected in the layer selection box, select the 'Numerical Digitizer' plugin
  4. Insert Long=x and Lat=Y based on the lat/lng coordinates collected in the previous step

Once done, you will probably not be able to see the points you created. This is because the points layer is based on a lat/lng scale while the DFX shapes are not. Right click on the new points layer and select Zoom to Layer. You should now see the points you created.

Bend, Rotate and Scale the DXF shapes

Now that we have the original DXF Data Layer and a points layer in QGIS, we can bend, rotate and scale the DXF Data Layer to match the lat/lng coordinates. To do this we are going to use the Vector Bender plugin.

NOTE: The Vector Bender plugin is listed as experimental. 'Show Experimental Plugins' must be checked in the Plugins settings box.

Create a Vector Bender layer

Vector Bender will create another layer that will be used to draw lines between corners of the DFX shapes and the points placed on the map.

  1. Select Vector Bender under Plugins
  2. Select the layer from the DFX file under 'Layer to Bend'
  3. In the Pairs Layer, click on the Node Tool in the Vector Bender dialog instead of selecting a layer. This will create a new layer in QGIS.
  4. Close the Vector Bender dialog.

Bend DXF data layer

Now we will connect the points layer with the DXF data layer.

  1. With the Vector Bender layer selected, select the Add Feature tool.
  2. Select a point in the DXF data layer and drag it to the corresponding point in the Points layer. A left click will select the points to connect. A right click will release the line.( This will likely require panning and zooming.)
  3. Once two points are connected, open the Vector Bender pluggin and click run.

The DXF data layer will be rotated and scaled as necessary.

NOTE: It is possible that steps 2 and 3 will need to be done again to further bend the shape.

Export the layer

When the data layer has been matched to the coordinates, select the layer and export using the 'Polyline Encoder Exporter' plugin. The resulting .csv can be loaded directly in to QlikView or Qlik Sense.