3

I'm still pretty new to QGIS, so I may be missing something basic here.

I'm trying to export several layers from a GIS project to DXF so we can create a base map in AutoCAD. However, even though all the layers are aligned correctly in QGIS, each layer shows up in a different physical location in AutoCAD. That is, each individual layer is spread all through the model space in CAD. This occurs whether I export each layer separately or in a group.

Can anyone help figure out why this might be happening, and how to correct this?

1 Answer 1

2

I doubt that this will be the whole answer - and please note that I used AutoCAD for the first time today in exploring a similar problem - so this answer is hot off the press and may well be off target...

If you use 'save as...' to export the QGIS layer as a dxf then note that written into the dxf file is 'header' information announcing that the units for coordinates in the file are 'English' (rather than metric) inches - and this happens irrespective of the units actually used in the GIS layer. To give an example QGIS takes a layer in metres (in my case on the GB Ordnance Survey grid 27700), and correctly exports these numbers into the dxf file in metres - but the header information in the dxf says incorrectly that these are 'English' inches.

When you use the AutoCAD 'insert' function (or simply drag and drop the dxf into the drawing) AutoCAD takes note of the header information. If you are using an AutoCAD template in inches then things seem to work out fine... numerically at least (i.e. what's recorded as at coordinate 1000,1000 in the dxf will appear at coordinate 1000,1000 in the AutoCAD drawing even though metres have now become inches on AutoCAD.). If you're using an AutoCAD template (e.g. acadiso) based on metric then the data will appear elsewhere... presumably based on AutoCAD thinking that it's importing inches and doing some conversion.

To solve... a bit irritating but works... open the dxf in a text editor, look for the information $MEASUREMENT 70 0 and change the 0 to a 1 (declaring that the data is in metric). Find the information $INSUNITS 70 1 (??or 0??) (which means that the numbers in the file are inches) and change this to a 4 to declare them as millimetres, 5 = centimetres, 6 = metres, 7 = kilometres ( see dxf information )

At this stage I think you need to be understanding how the AutoCAD template is set up. My colleague was using the template acadiso and measuring things in metres - when I understand that the units in that template are actually meant to be millimetres... so my GIS data then needed to be scaled by 0.001 on import (or alternatively declared in the dxf header as millimeters).

Insert into AutoCAD now works fine if everything matches up (the numbers in the file, the header correctly declaring the units, and the AutoCAD template set up to use those units).

Further answers to pursue... the 'export project as dxf' functionality (project menu) may be different. I see some discussion about this. I'm also searching for an option somewhere to make sure that the export header information is changed for all exports from QGIS.

1
  • Thanks for the info. I'm almost embarrassed to say: I didn't realize there was an updated version of QGIS (2.18) until today. I updated, and everything worked fine! Hopefully this helps other people, though. Thanks again! Commented Dec 2, 2016 at 17:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.