In order to continue to investigate our options for producing Q5 from Qgis, it is necessary for me to find out what I can use Inkscape for. From the previous posts, you may recall I was looking at exporting map views to SVGs and then editing them to add additional captions in order to get around the limitations of automated caption (label) placement in Qgis. In order to do this I have to learn how to use Inkscape.
Inkscape is a very powerful graphical editing package (and also free and open source software, like Qgis) that uses SVG as its native format. SVG or another vector graphics format, if you will recall the previous discussion, is the preferred format over bitmaps, which I have used up until now to put maps together. All future maps produced will be using SVG as an output format, which for MS Word will be pasted into the documents as EMF, a Microsoft proprietary vector graphics format. Whatever the format of the file, it will produce the highest possible print and display quality in a vector graphics format, because that format scales to whatever the size of the printout is.
So as I discussed in my previous post, there is a limit on placement of the automatic labels by Qgis, and I decided therefore that some of them would have to be put in using Inkscape. As layers are supported, it would be advantageous to have these in a separate layer, though it is by no means essential, since the SVG format ensures that each feature of the image is stored as a separate object. This makes it almost possible to create the whole map in SVG to begin with if that was what you felt like it. There isn’t actually any advantage to drawing it that way, but I thought I would just point out that this is certainly not a bitmap format with all of the image stored as a whole lot of different coloured pixels that can only be edited at that level. Each feature (for example the lines and symbols that represent rail tracks and stations) is stored as an object and can be edited on that basis and independently of other objects. You can select a station symbol on the map and then move it around as easily as you can in Qgis. But we use Qgis to put them in because it has a lot of GIS features that an image editor like Inkscape doesn’t know about.
As I noted in the previous post the first step in turning our SVG into a workable map is to clean up the errors produced by the SVG export plugin in Qgis. This image shows how I have removed the paths that were spilled outside the print composer rectangle so that it now looks exactly as it did in the print composer. The next three things to be done are to:
- Fix the changes in open circle and open square symbols, where the export has resulted in a thicker border than was used in Qgis
- Move some of the Qgis generated captions to more convenient locations (where they are in the way of other objects); and
- Add a few more captions where they are useful. In this case we are going to add captions for the four bridges (the Weka Pass viaduct and the Waitohi River, Hurunui River and Pahau River) and also the Waiau River which is prominent at the top of the picture although the Waiau Branch did not cross it.
Here is the next iteration of the map with the existing captions moved into better positions and the symbol line thicknesses adjusted to be consistent. One point of note from using Qgis to label the stations is the buffer which is put around each label (when this feature is turned on), basically this is a white border around the text. This turns out to be an extra object which has to be selected and moved along with the text. The buffer is actually only useful when you are drawing text that goes over the top of other objects, and since we can move the labels so that they aren’t over the top of other objects, we can turn off the buffer setting so there is less work involved in moving the captions. Another issue with the text generated by the SVG export from Qgis is that it is not exported as an SVG text object, but as a group of paths (each letter would be a separate path). This means it can’t be edited using the text editing tools in Inkscape. In other words, these auto generated labels are only useful as long as they are correct. You can move these labels around like objects, but you can’t edit them as text objects in the SVG. To be realistic, they should not need to be edited; it is really a question of whether the fact they are exported as paths rather than text objects has any impact on the print or display quality.
Above is the final rendering of the map for this post. The station name labels on the Waiau Branch have been realigned (the second line was indented compared to the first line in general) and the buffers around them removed. I forgot to label the Waiau River when I put in the labels for the four bridges which appear above in italics. The map was able to be printed out from Inkscape and it looks very good on paper, being of a high quality; far far better than any of the bitmaps I dumped out previously would have been. I remember looking at Inkscape earlier in the piece when I was first looking at systems I could use to computer draw the maps. That was before I decided to use a GIS (which of course is Qgis). The context at the time was that a KML to SVG convertor was available and it was proposed to convert all the KMLs I have from Google Earth into SVGs that could be used to generate simple maps (like Q4 maps generally are). This was one of the many options I investigated for being able to generate maps electronically (on the computer) to replace Q4’s hand drawn maps. In the event, the fact I have been able to use Qgis for the map generation is light years ahead of Google Earth – for one thing Qgis is far more stable. Over the years the amount of work I have lost owing to the frequent crashes of GE has been very substantial and enough to make you really wary of doing something this big in it.
The next posting in this series will look at map rotation which is supported in QGis print composer but it doesn’t automatically straighten the labels. It should be possible for Inkscape to rotate the labels back to horizontal in such eventuality. Being able to rotate the maps is useful for some of the depictions in certain pages of Q4 where it is generally being used to maximise the efficiency of using the map canvas, by displaying multiple map sections on one page.