If you have used the pie chart facility in QGIS you will be aware that there are some limitations for its use. For instance, you cannot currently automatically create an exploded pie chart. Nor can you easily position labels relating to the pie chart on map output.
Here is an example of a pie chart which has two variables. Using a label expression it is possible to show both variables on the map near the relevant pie charts. Recent versions of QGIS have included the ability to move, hide and rotate labels. Moving labels has always been available as a feature within MapInfo. These labels were then referred to as being personalised. Until recently you could only move labels with QGIS if you created additional columns in your attribute layer as well as taking several other steps within the software. Fortunately, that is no longer necessary. However, no matter how many additional features are provided within a new software release users will always want yet more functionality.
In the above screenshot, currently the labels for the pie charts are not positioned sufficiently closely to be meaningful. Also, the only way of knowing which label refers to which part of the pie chart is by guessing which is most likely to be green or blue. In this example that is not particularly difficult but if the split was more even say 48% to 52% this may present a problem.
Whilst it is possible in QGIS to move the pie charts and the various labels, it would be better if the pie chart could be exploded with the relevant label indicated by a pointer of some sort. Also the labels have been created with an expression and reside on the same layer so cannot be separated to be assigned to segments of the pie chart.
Currently, it is not possible to make such changes within the QGIS software. However, if the map is exported as a PDF further modifications can be made within alternative software packages. Whilst GIMP and Krita have the ability to work with PDF documents they are more suited to purely raster based applications. Also, whilst both programs are very powerful open source solutions they have a fairly steep learning curve for absolute beginners. Alternatively, vector based editing software such as Inkscape can also handle PDF documents but again the learning curve is fairly steep for a beginner who only wants to achieve limited objectives.
Having tried out all these various solutions I found that the Draw program within the Libre Office suite was capable of modifying PDF’s generated by QGIS fairly easily as it is capable of handling both raster and vector geometry
There is no need to open a PDF of the pie chart map without the background OSM raster data as in the following screen shot. This would be a strategy if you were using raster editing software like GIMP. In this way you would be able to move elements such as the pie chart and labels without impacting upon the raster map. GIMP can handle multiple layers so after making changes to this layer you could introduce a background map to complete the editing process.
Fortunately, because Draw can differentiate between vector and raster elements of a PDF none of the previous steps necessary in GIMP are needed.
Open your PDF directly in Draw as shown in the following screenshot.
Zooming into the Swansea area and then selecting the Select tool from the Tool bar enables you to highlight one of the labels as in the next screenshot.
If required the pie chart could be further modified by separating the pie chart elements together with creating arrow pointers. To move an element of the pie chart use the Selector tool. Click on a segment to highlight it and then move it away from the other sector.
Choose Connector ends with arrow from the tools options and place the cursor over the pie segment you want to connect an arrow to. Next drag your cursor to the label and an arrow will be created as shown in the following screenshot.
The final output will then look similar to the following screenshot.
As we can move various elements within the Draw program without disturbing the raster background you can more or less modify the map to suit your requirements.
In conclusion, whilst QGIS is a very powerful GIS there is always something that users will want that the software cannot currently provide. In the meantime, using Draw can be a way of circumventing any perceived limitations.
From time to time you may want to use information held within an Access database for a QGIS project. QGIS can join Access databases to a layer’s attribute table if there is a common field. For example, if you had a Postcode field in your Access database this could be linked to a postcode CSV file downloaded from the internet. Then your Access data could be geocoded.
In QGIS you can insert the downloaded postcode CSV file by selecting the Points coordinates option and Latitude and Longitude for the X and Y fields in the dialogue box. The Sample Data will confirm that you have successfully imported the file.
Adding the data to QGIS will produce a set of points in the Map window.
To verify that the data is correctly imported you could add a background map from Open Street Maps.
Now we have successfully imported our Bristol postcode data we can join an Access database table in order to geocode our Access data.
In the Data Source Manager | Vector dialogue box select the Database option and select ODBC from the Type drop down box.
If you haven’t set up an Access connection on your computer you will have to type ODBC in the Windows search box which will bring up a couple of options.
If you are using the 32 bit version of QGIS then you can select this option. If you are using the 64 bit version then you may find that there are no entries for Access database drivers. In this case you would probably think you could use the 32 bit drivers as shown in the next screen shot.
If you select the Add option you will find a number of Access drivers. As my Access database file is fairly old I would choose the .mdb option.
Click on Finish to bring up the ODBC Microsoft Access Setup dialogue box. You should enter a meaningful name in the Data Source Name box then click on the Select button.
Next as you are in the systems directory double click on the c:\ to get to the root directory. Now find your Access file and highlight it.
Click OK to confirm that the database is correctly identified. Click on the Advanced option if you need to provide a Log in and Password.
Next click OK and finally click OK to close the ODBC Data Source Administrator (32-bit) dialogue box.
We have are now ready to use this data source to connect your database to QGIS.
Select New and complete the Connection Information box as shown in the above screen shot. If you test your connection you will get the Test Connection dialogue box stating that the connection has failed.
If you do an internet search to resolve the problem you will come up with something like the above screen shot. It appears that QGIS 64 bit doesn’t support 32 bit Access drivers. One solution offered was to uninstall the 64 bit version and install the 32 bit version of QGIS to get round this compatibility issue. Alternatively, you could just do a search for 64 bit Access drivers.
Once you have downloaded the 64 bit driver and installed it by clicking on the executable you will able to create a data source in the 64 bit ODBC dialogue box.
Now if you create a new connection you will find that the Test will be successful. Click Add in the Data Source Manager | Vector dialogue box and your Access tables will be available for use within QGIS.
You can select a specific table or all available tables for use within QGIS. Remember that these tables are read only and therefore you need to create fields within the layer you are joining your Access tables to. This will ensure that any data you wish to keep is copied across to your attribute table and not lost when the join is removed
The basic concepts of desktop GIS software haven’t really changed very much since their inception with MapInfo Pro software some thirty years ago. The original designers of desktop mapping software wanted to use the new Windows operating system to emulate the functionality only previously available with the help of skilled cartographers.
The concept these early designers wanted was to emulate paper map creation but in a digital format. One of the main ways they achieved this was by using a process whereby each element of the map could be built up through creating a series of layers prior to printing the final output. Features which we now take for granted such as zooming and panning where at that stage innovative and novel to new users of GIS software.
If we look at a screen shot from QGIS we can see that the map area is displaying a map of Mexico. On the Layers panel on the left side there are five separate layers shown. Each layer represents data in either a point, line or polygon format. All of these layers are in a vector data format.
Vector data could be defined as a list of values. For example, a point has a pair of x and y co-ordinates, a line has two pairs of x and y co-ordinates and a polygon has points where the first and last co-ordinates are joined to create an enclosure.
The layers have been brought into QGIS as individual layers which means they will display in a random colour. If these layers had been brought in as a project file each layers’ defined colour scheme would have been preserved.
The next thing to note is that although we have five layers only one layer is currently displaying. This is because top polygon MEXICO layer is hiding the features of the other layers. Again, if this had been loaded as a project file the correct layer order would have been preserved.
Clicking on the MEXICO layer and moving it as shown in the next screen shot will reveal the other layers’ details.
If you are new to using GIS software or a casual user you may be surprised to learn that standard formats such as shape files do not contain sufficient information for successfully transferring data between systems.
For instance if you have been sent some shape files together with how they should appear in your system, and you are presented with something different when they are loaded, there is a simple explanation.
Here is a screen shot of how two layers should display in your system.
And here is how it may look if loaded in just a default shape format.
The Microsoft windows file management system was developed to enable users to easily save, copy, delete and move files within a hierarchical folder structure. Each file type is identified by a dot definition system. So a Paint program file could have a .png, bmp or .gif format. A text file could have a. .doc format. An excel spreadsheet could have a ,xls format. This file management system works very well for file types which generally consist of a single file format, however GIS formats such as Esri shape files or MapInfo tab files are made up of a number of different file types. This often presents a problem for casual GIS users when copying, deleting, moving or saving such files through a file management system such as Microsoft Windows. Often only the .tab or shp file element is copied which means that the specified file will not load into a GIS system.
In the above screen shot from the Windows file management system the shape file format can be seen to consist of four files, all of which are needed to produce a map layer in a GIS.
ESRI have addressed this problem with the introduction of ArcCatalog, which is there own proprietary file management system. Within ArcCatalog various filetypes are stored is such a way as to enable the user to access the various elements as if they were a single file. Additional features enable users to preview maps within ArcCatalog as well as the ability to drag and drop files into the map surface.
You can use attribute data attached to individual layers to find out about information relating to projects within your GIS. Additionally, you can also find answers to questions regarding the spatial relationships of the features within a selection from within the layers.
This ability to query spatial relationships enables you to answer questions such as, how many airports are within a region, which rivers cross boundaries, which countries have a common border or how many cities have a population in excess of two million within a specific country.
In the same way GIS can also answer questions about health, income, crime levels and employment within a certain geography.
Looking at the London boroughs we could ascertain, with the help of GIS, which are the poorest and which are the most affluent.
Here is a map of the London wards. There are 4765 ward entries in the attribute table for this map layer.
If we just wanted to query data at a borough, rather than the ward level, we could use GIS to create a new layer. We could achieve this by using a geoprocessing tool to dissolve the current 4,765 wards into 33 boroughs. This results in a map layer similar to the following screen shot.
If we also download spreadsheets containing information about health, education, income and employment they could be joined to our London borough map attribute table to give us a picture of each boroughs’ performance. .
Here is a map showing crime levels across the 33 London boroughs. The darker the colour the higher the crime levels.
Each feature within a GIS has appropriate attribute data attached to it. This data can contain information such as, in the case of a city, its name, size of population and other relevant details.
All GIS store data in a format which is commonly referred to as an attribute table. Each layer contains an attribute table which is similar to a spreadsheet layout. Within this table the user can put as much or as little information as is required for the layer’s requirements. Like a spreadsheet the data is stored in a series of rows and columns. Each row represents a single record and each column represents a field within the table. Some tables only contain a few fields with a limited number of columns, whilst other tables, say containing crime statistics, can have thousands of records and numerous fields.
Information within the attribute table is linked to the point, line or polygon within the map layer. Clicking on one or more features in the map layer will also highlight the same features in the attribute table if this has been made visible. Similarly, clicking on one or more rows in the attribute table will highlight these features in the map layer.
Desktop geographical information systems use scale to represent the relationship between the size of elements within the map and the related areas within the real world. In fact it is very similar to the methods used with paper maps. However, paper maps are produced at fixed scales to meet different requirements. This contrasts with the flexibility of a desktop GIS which can produce an infinite variety of maps by adjusting the scale to meet specific requirements.
A ramblers paper map would have a scale which relates more closely to a specific area of interest. A map used for travelling over larger distances by car for example would have a different scale. The only way someone could take a closer look at a detailed paper map would be to use a magnifying glass which would have no impact on the scale of the map. However, with a desktop GIS there is the capability of zooming into areas of interest which then automatically adjusts the map scale.
So with a desktop GIS the zoom feature enables users to view maps at a variety of scales. In the following screen shot the map is shown at a world view of 1:186,760,885.
In the next screen shot the scale has been changed to 1:13,877,198 as we zoom in to take a closer look at an area including parts of the United States and South America.
The effect of zooming in shows that in the above map is now nearly fourteen million times smaller than actual size. The map now has a scale value of 1:13,877,198. The zoomed in area of the map within the GIS has in other words a ratio 1:13,877,198. This represents one unit on the map as almost fourteen million times smaller than in the real world.
We can also indicate the scale of a map by adding a scale bar to maps that are printed. We can set the scale to the desired measurement which could be either metric or imperial. In the following screen shot we have set the scale in kilometers.
So as we zoom into a map we can obtain a closer view of the map’s features. At different scales we can obtain just the right amount of information for our specific requirements. The ability to create a variety of maps from a single map source is made possible by the flexible scaling features within a modern GIS system. Maps can then be printed at a suitable scale to meet the user’s requirements.
Prior to the availability of computerised mapping facilities paper maps were often used in conjunction with acetate sheets in all forms of mapping applications. At that time the latest paper map of a county or region would have been an expensive outlay. Within the UK, local authorities obtained their paper maps from Ordnance Survey often buying updates several times a year at a cost of thousands of pounds.
Because the maps were expensive it made sense to ensure that they were well looked after. Sometimes this was achieved by laminating the maps to stop them being damaged by accidental spillages. If additional information was needed to be added to these base printed maps, acetate sheets were used. These acetates were used to mark out, for example, property boundaries or crime incidents. In this way several layers of information could be added without causing any damage to the printed base map.
Today, the modern desktop gis uses the same principal to separate the base map from other information stored within the system. The layer system enables the user to break information down into specific areas of interest. For instance in a map of Alaska all the airports are contained within a separate layer within the gis. This information on its own would not make a great deal of sense without the underlying base map as the following graphic shows.
Without the underlying Alaskan base map the airport layer does not make a great deal of sense as it is not related to anything meaningful in isolation. In the next graphic the airport layer makes sense as it shown with the relevant base map.
Maps can have many layers within a project. Layers can be present within the map without being visible. This enables specific areas in the project to be analysed by the map maker. Often a map may contain very many layers and it this case it makes sense to group related layers. In grouping layers you can then more easily manage whether the group is displayed or not. The group of layers can then be turned on or off together rather than manually turning off the related individual layers one at a time.
Some gis systems, such as MapInfo allow placement of points, lines and polygons within the same layer. However, whilst this is possible within MapInfo, if you need to transfer to a different gis you may find this creates problems. Both QGIS and ArcGIS have a layering system which only allows for one type (point, line or polygon) to display within a layer. Transferring data to QGIS from MapInfo with layers containing a mix of types will result in QGIS creating additional layers during the conversion process. Alternatively, MapInfo can convert layers to a shape file format which both QGIS and ArcGIS can then use.
Layers can be in a vector or raster format. Vector layers are either points, lines or polygons which can be in an x and y, or latitude and longitude format. Raster data consists of a series of dots and is often used to represent for example, ocean depths or variations in vegetation growth. In the next screen shot a raster layer has been added to the Alaskan map.
Layer order is important when displaying data within the map. If the layers are not ordered correctly some layers may not display correctly, if at all. To change the layer order you only need to click on the layer within the layer control section, hold the mouse down and then move the layer up or down to achieve the correct sequence.
Maps have been used for a long time as a means of providing a visual understanding of the world around us. Some famous examples of maps have had a dramatic effect on our environment and our perception of the why events occur.
The map of the 1854 Broad Street cholera outbreak clearly shows how the epidemic spread from residents drinking contaminated water. John Snow’s study showed how the contaminated water supply was linked to the maximum fatalities in close proximity to a specific water pump. These fatalities were represented by points on the map. The most points surrounded the contaminated water supply. Thus a map was able to prove what John Snow suspected as the cause of the outbreak.
Another famous map shows in graphic detail how Napolean’s army was decimated during the 1812 Russian campaign. This map is basically a graph or flow chart of the size of Napolean’s army on entering Russia and how it was reduced to a ragged remnant towards the end of the journey back.
Both these maps were the work of skilled cartographers. They would probably have been amazed at the way in which modern GIS systems can produce diverse maps without the cartographic skills they had spent years developing.
With a modern desktop GIS a map of Alaska could, for instance, show a variety of different scenarios from the same base map. Below is an example of a base map of Alaska.
With the help of some data we could produce different maps on climate, population, land use or vegetation. In fact with the data, now freely available on the internet, you could produce maps on an unlimited variety of subjects.
Since the advent of desktop GIS mapping solutions it has been possible for virtually any individual or organisation to produce maps to meet their specific requirements. Mapping is no longer the specialist area of skilled cartographers producing maps by hand. Nor is mapping the domain of large corporations who, in the not so distance past, could afford the mainframe and mini computers which cost millions to buy and maintain.
All modern gis systems can produce such maps without the user having to need any specialist cartographic knowledge. Although a general understanding of cartographic principles would obviously be useful in order to produce quality output.
The map below of Alaska contains a number of layers showing the regions, airports, lakes and many other features of interest.
In most cases the final map, for printed output, will contain a legend to explain what the various points, lines and polygons represent.
Joe Short BSc has been involved with various mapping solutions for over twenty years. If you are considering implementing a GIS or have ArcGIS Pro, MapInfo Pro or QGIS training requirements, jps services would be happy to be of assistance to your organisation.