Terrain Relief Models, Unabridged

QGIS – Exporting Your Maps

Exporting your heightmap

With your elevation data all ready in a new clipped raster layer, you can now start wrapping up your time in QGIS by finally getting to the Heightmap Export plugin.

  1. From the Raster menu, go down to Heightmap Export and choose Heightmap Export. (Yeah, it’s redundant; I may fix that up a bit in the next release.)
  2. Under Create Heightmap From Layer, choose your elevation data raster layer.
    • The Map Area box will show the height (N/S), width (E/W), highest elevation, and lowest elevation in meters.
  3. In the Model Dimensions section, enter a value in Height (mm), Width (mm), or Depth (mm). The other values will be adjusted to scale.
    • The Scaled Depth (mm) and Scale Factor (1:?) boxes allow you to easily try out expanding or compressing the vertical axis.
  4. In the Image Dimensions section, enter a value for Image Height (in pixels), Image Width (in pixels), or Resolution (mm/pixel). The other values will be adjusted to scale.
  5. Click the Export Heightmap button.
  6. Choose a name and location to save the exported file. (The default name is the layer name with “_heightmap.png” tacked on the end.)
  7. Click Save.

    The plugin saves a 16-bit greyscale PNG heightmap image plus an additional file with the same name and an .ini extension. This .ini file contains the bounds, size, model dimensions, and image dimensions and can be opened in any text editor for easy reference. (It is also used to pre-fill values in the PathTracer dialog, should you later use that.)

  8. Your heightmap is ready. You can close the Heightmap Export dialog.

Exporting and SVG-ifying your path data

While there is apparently an alleged SVG export plugin for QGIS, I have found that it does not yield cromulent results. To get the path data into a nice SVG, we just have to take the slightly longer way around.

  1. In the Layers box, right-click the path data’s vector layer, go down to Export and choose Save Features As...
  2. Select AutoCAD DXF from the Format drop-down.
  3. Click the ... to the right of the File name box and choose your filename and save location.
  4. Uncheck Add saved file to map, as we’re just exporting it.
  5. Click OK to save.

    You have now saved a DXF with your path data, but the scale is all wrong and you’d really like a properly scaled SVG instead. Never fear, Inkscape is here!

  6. Open Inkscape.
  7. From the File menu, choose Import... (Ctrl-I) and choose your DXF file, or if you prefer drag and drop, grab the DXF file and drop it onto the Inkscape window. The DXF Input dialog will pop up.
  8. For Method of Scaling, choose Automatic scaling to size A4.

    This is almost certainly not the actual scale you’re using, but the important thing is that it gives sane dimensions on import. You’re going to enter the correct dimensions, anyway, and starting with it scaled to A4 means that it won’t be inconveniently huge or tiny. Sometimes being “wrong” is just plain convenient.

  9. Click OK to load the DXF.
  10. Select everything from the DXF (e.g. drag a box or whatever).
  11. Press Ctrl-G (or choose Group (Ctrl-G) from the Object menu) to group the pieces.
  12. Edit the width (W:) and height (H:) input boxes up in the toolbar above the window (with the aspect ratio icon unlocked) to match your model’s intended dimensions (which are in that .ini file if you’ve forgotten them).
  13. From the File menu, choose Document Properties (Shift-Ctrl-D).
  14. With the grouped path data selected, click the Resize page to drawing or selection button.
  15. Save your file as a new, wonderful SVG.

    If you added temporary line segments, they’ve done their job helping you get the scaling and alignment right. I would, however, suggest keeping them around in the design and only deleting them right before making any toolpaths. Keeping them around allows you to rescale, crop, and so on, and if you load the SVG into something like Carbide Create, they really help with alignment there, too.

3 Likes