Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
BACKGROUND
This is an introduction to QGIS 0.9.1, a program that can manipulate geographical Another type of map data is called raster data. Two examples are satellite images
data and display the results on screen. It draws maps, in other words. The initials and aerial photographs. QGIS can import rasters. Instead of the shape of a river
stand for Quantum Geographical Information System. GIS is the general term for appearing on your map you will see an actual photo that aligns perfectly with the rest
these types of programs. of the map. I will not be describing how to use raster data in this introduction, mainly
QGIS can be downloaded free of charge (freeware) from this site. It is available because I don’t know how to do it. If anyone reading this knows the trick, please
for Mac, PC and other platforms. This introduction is written for the Mac, but the email me instructions, including sample data suitable for use with the map shown in
majority of it is applicable for PCs as well. QGIS is not the only freeware GIS these notes. But please check that it works with this map.
program: Now, back to shapefiles. Three folders of shapefiles are included with this
package:
• GRASS (several platforms) has been in development since 1982. It is a powerful
program, but difficult to master. You need a certain level of skill to even open it (or • Coastline of Australia
the right software, such as OPENOSX GRASS). • Rivers & Creeks
• State Boundaries
• ARC EXPLORER (PC & Mac) is for education. It allows you to view maps, but you
cannot do much manipulation with the map data. The way it operates is very similar If you look inside the Coastline of Australia folder (the other two folders contain
to QGIS, though QGIS is more powerful – and more unstable (it has more bugs). similar files), you will see four files typical of the shapefile format:
• TATUKGIS Free Viewer – PC only. And since I’m a Mac man, I can’t comment on • Coastline.dbf – a database that contains details (‘attributes’) of the features;
it. • Coastline.prj – describes the map projection;
• Coastline.shp – contains the shape of features (lakes, rivers, and so on);
The power of these programs lies not in the ability to draw maps – most drawing • Coastline.shx – index file.
or image programs could be used to draw a map – but in their ability to use data to
draw maps automatically under your control. There are lots of varieties of map data, By using QGIS and the data in these folders, you will be able to draw a simple
but I will be using only one type to demonstrate how QGIS works: ESRI shapefiles. map of Australia if you follow these notes. The map will include state boundaries
Some government mapping agencies, such as Geoscience Australia, make this data and a small number of rivers. One feature will be added at a certain latitude and
freely available. longitude. Then the instrucitons will describe how to save the map to an image file so
Shapefiles are a type of data called vectors, a commonly used word in QGIS. that it can be emailed or used inside a text document.
A vector is a word that simply means you need at least two numbers to describe a I have tried to design these instructions so that anyone with a basic knowledge
certain item. Your speed when driving, for example, is not a vector because it only of computers but no knowledge of GIS, can draw a simple map. I hope that what
needs one number: 80 km/h. On the other hand, to locate the Sydney Opera house took me four days – searching on the internet for programs and data, and scratching
needs at least two: latitude and longitude; and three, if you want to know its height my head in front of my computer – will be reduced to an hour or so for anyone who
above sea level. To describe the shape of a coastline, a river, a lake, or the position of works through these instructions. And I hope you will be surprised how easy it is.
towns and mountains, requires lots of numbers. A shapefile is a long list of numbers This is only an introduction. What you see here is my total knowledge of QGIS.
(vectors) that tell QGIS how to draw features on a map. I don’t know anything about rasters or projections or other data formats. For more
detailed information you’ll have to go to other sources.
WHY USE QGIS? WHAT YOU NEED TO MAKE A MAP
In my case – to draw maps to illustrate the routes of early explorers in Queensland. You will need QGIS from the QGIS website, and the shapefiles as described
There is no quicker way to bore a reader than to reel off a list of place names, mountains previously (Coastline of Australia, etc) which are included with this zip package.
and rivers. A simple uncluttered map has the power to bring a geographical story to QGIS is a bit fussy about where the shapefiles are located. On the Mac, for
life in a way that even a thousand words can’t do. I used QGIS to generate a base map instance, it can’t find files that are on external firewire drives (unless you have typed
of Queensland with all the features that I needed, then I selectively zoomed in or out in /volumes in the File Name field). For this introduction I suggest you create a new
and incorportated only those features I needed for a particular map. Basically, I drew folder called Mapping, and copy the shapefiles and QGIS to that folder.
one map and manipulated it to draw all the others, about 30 in total. One more thing about location. QGIS calls making a map, a project, and it does
The completed maps (see the PDF file Samples, included with this zip package) not store the map data within your project. It remembers where the data came from and
were not output directly from QGIS – it does not have the capability or flexibility to looks for it there every time you open the map. If you move the shapefiles somewhere
draw a finished map of the type I wanted. Rather, I used QGIS to generate the map else (because you don’t like them within the folder Mapping, for instance), or you
features (mountains, rivers, towns) which I then used as a template. In other words, I rename the files, QGIS will ask you where they are, and you will have to tell QGIS
spent a few minutes and traced over the top. My maps were simple enough to allow where every single file is that you have moved. And that brings me to the first bug
me to do that. In a few cases I did use the QGIS output, for example, when I wanted within QGIS 0.9.1 (assuming it has carried over from 0.9):
to use detailed contouring or a complicated river system as a background.
If there are more than 5 or 6 files it can’t find, it will crash.
There is another bug that requires QGIS and the data it is using to be on the
same hard drive. If you have partitioned your hard drive, QGIS and its data must be
on the same volume. If they are not, you will have problems editing. On the Mac,
the easiest way to ensure you have no problems with this introduction is to put
QGIS and its shapefiles within the folder Mapping (or any folder you like).
QGIS WINDOW
The first time you open QGIS, it won’t look like this. This is what we
are aiming for. I suggest you resize the entire window to fit on screen, then
resize the individual windows to suit
yourself. There are three windows:
When you select File > Print, the Print Composer window shown at top right opens up. This
window (General settings) allows you to set the paper size (there are a number of common sizes
that can be selected, other than the Custom size show), and the resolution. The white box is where
your map will appear when you go to the Item settings. In this example, the white box shows a
blank A4 landscape page. To get your map to appear in the window as shown bottom right:
1. Click on Item.
2. Select the Add New Map icon (sixth from right).
3. Draw a rectangle of the approximate size, shape and position where you want your map to appear on
the page. I call this the map box.
4. The whole of the map that appeared in the Map View window before you decided to print, will now
appear centred in the map box you have just drawn. It doesn’t matter what size box you draw, you
always get the whole map. It will just be smaller or bigger, depending on the size of the box.
5. The map box can be moved by clicking inside it and dragging. It cannot be resized with the blue
handles, as you might think. To change size you have to enter the Width and Height in millimetres.
There are two options under Set. The default is Extent (calculate scale). With this setting, the
entire map that you saw in the Map View window (the ‘extent’ of the map) is squeezed into the map
box you drew on the blank A4 page (Step 3 above). You never get anything less than the entire map
– but the scale will change in a complicated way as you change the aspect ratio of the map box. For
example, if you make the map box tall and thin, Australia will get smaller and you will get a lot of
white space above and below your map. All of the map will always be there, but there may also be
white space.
The second setting, Scale (calculate extent), is, for me, easier to visualize. The Scale setting acts
like a zoom: enter a smaller number (a small-scale map) and everything gets larger and you’ll see
less of your map. If you make the map box smaller, you’ll also see less of your map. Whereas with
Extent (calculate scale) you’ll always see the whole map, but the scale will change.
If the map has to be shifted within the map box, you can’t do that within Print Composer. Move
the map around in Map View, and when you return to Print Composer click on the Set Extent button
which forces the centre of the map box to be the same point as the centre of Map View.
Notes:
• Line width scale sets the width of lines (rivers, coastlines) in mm.
• If you are playing around with map boxes, you may end up with several of them. The only way to get
rid of them is to set their width and height to 0 and then click with the mouse.
EXPORTING AN IMAGE MEASURING DISTANCE
There are two ways of exporting an image. File > Save As Image will grab what To be able to measure distance in metres (or feet):
is on the screen, pixel for pixel, and dump that to a jpg or png file. If your Map
View window is set to a small size, say 750 x 580, that will be the pixel size of 1. Go to Settings > Project Properties > Projection, and choose Enable on the fly projection.
your image. To gain control over the image resolution you have to use the Export
as Image icon within Print Composer. These are the steps I suggest in obtaining the 2. Go to Settings > Project Properties > General and choose Meters (if you do this before
step 2, or as part of step 2, QGIS will override the meters setting and apply the degrees
best quality image from QGIS suitable for printing. For emailing or the web, Save
setting. You will end up with weird measurements like 471,792.87 degrees)
As Image is probably good enough.
3. Select the Measure Line icon, click anywhere on the map as a starting point, click
1. Decide how big the printed image is to be. Let us assume 8 x 10 inches (200 x 250 anywhere else as an end point and you should see the distance in kilometres. At the bottom
mm) and assume the map has already been set up in Map View ready to export. It is of the map you should see the position of the mouse (lat/long) as you move it around.
best to make the map in Map View cover a larger area than required. It can always
be cropped in Photoshop or similar program.
2. Open Print Composer and choose a Custom size paper slightly bigger than that
required for the print, say 220 x 270.
3. Set the resolution to at least 300 dpi, preferably 600.
4. Select the Add New Map icon and draw a box just inside the boundary of the map
box. Your map should appear inside the box you have just drawn.
5. For thin lines such as contour lines to appear thin, the Line width scale should be
set to something less than 0.2 (this dimension is in millimeters).
6. Choose the Export as Image icon, png format, and click OK. Note: You must add
the suffix ‘.png’ manually. If you don’t, the image won’t be created properly.
7. Edit the image in Photoshop (crop, resample and so on).
Note: For maps with thin lines, png is the preferred format because jpeg throws
a halo around thin lines.