In this short tutorial I will explain how you can convert cartographic maps available in TIFF format to DXF, a vectorial standard available in most CAD software. The final result, nevertheless with some limitations and lacks, allows you a more productivity and improves the quality of design.
Sometimes I have to draw over a raster image, and if it is a map, I have many details to modify or semplify. Luckily in my Region, through the GeoPortale Regionale, I can download maps in DXF format, like you can prove clicking in this page Infrastruttura dei Dati Territoriali del Veneto - Catalogo dei Dati. Other Regions don't have this chance and most I can obtain is a TIFF georeferenced.
Well, if I have to do small additions in this file, I can simply import it in CAD like a raster image. Otherwise I use Inkscape, vector graphics editor GPL licensed, to convert the maps in DXF format.
In these cases I perform the following operations:
- Analysis of the source image: clean, fix some contour and selection of the interested part. I use GIMP, an image retouching and editing tool released under GPLv3 license, to do this modifications. If like me, you don't have a powerful workstation, I suggest you to select a very little portion of your image and make experiments on it. Then extend your settings to whole image (in this manner you can save time and hardware resources).
- Load resulting image in Inkscape with File --> Import (or Ctrl+I) and then after selected it click on Open, you can link (less resources used) or embed image.
- Select image with left buttom of your mouse and click Path --> Trace Bitmap (or Maisc+Alt+B)
- Convert choosing one of two procedures:
- Brightness cutoff, based on a given brightness level;
- Edge detection, based on J. Canny's algorithm.
- Reduction of the resulting vector graphic (i.e. the number of the total nodes that describe the image): select the image and enter in Edit paths by node modality (second icon at the top of the toolbox on the left side, it is sufficient to press F2 key), then select all nodes clicking on Edit --> Select All (or Ctrl+A) and then Path --> Semplify (or Ctrl+L). You can repeat this procedure again, but make attention because the image looses quality and details.
- Come back in Select and transform objects modality (or press F1 key) and save all, File --> Salva as (or Maiusc+Ctrl+S). In the bottom of the appearing menu, you have to choose Desktop Cutting Plotter (AutoCAD DXF R14) (*.dxf). You may install another extension called Better DXF Output, but it was released for the previous version of Inkscape and not anymore updated.
I put all the files in tiff2dxf.zip. Below some images:
|Conversion of the original image, following the two procedures described above (among parenthesis there is the threshold value) and finally semplification of the nodes|
|Loading in LibreCAD and drawing of a simple line using snap function|