Quick-start QGIS Tutorial

11
Quantum GIS (QGIS) Quick-start tutorial Updated 08/05/10 There is a ton of free help for QGIS on the web. Start with the software's website (www.qgis.org ) and their “Users Corner” located here: http://www.qgis.org/wiki/Users_Corner#How_to_use_QGIS The QGIS v1.4 Users Guide is linked from that site but also here: http://download.osgeo.org/qgis/doc/manual/qgis-1.4.0_user_guide_en.pdf The below instructions will guide you through starting a new QGIS project and adding vector and raster data to the project and printing a map created in the map Composer. Some more advanced topics are covered in part II. You will primarily be using Shapefiles to make maps with QGIS. Shapefiles are the most widely used and accepted GIS data format although not the best in which to store relational GIS data. But in Open Source software such as QGIS it is the simplest data format to use and edit and shapefiles are also the end product of using the GPS in the field. Moving relational data to a Relational Database Management System (RDBMS) such as PostgreSQL/PostGIS, SQL or Oracle in ArcSDE/ArcGIS is recommended but takes more time and expertise to create and manage. 1. Creating a new map project with a new empty map. a) Start QGIS (use the desktop shortcut or goto: Start > Programs > Quantum GIS) b) Start using QGIS with a new empty map - New Project button. (QGIS projects have the file extension .qgs) 2. Add data to map . In QGIS, it is better to add Raster data first because of projection issues. There are buttons on the top toolbar to add many types of data including Vector, Raster, WMS, PostGIS, Grass, etc. 1

Transcript of Quick-start QGIS Tutorial

Page 1: Quick-start QGIS Tutorial

Quantum GIS (QGIS) Quick-start tutorialUpdated 08/05/10

There is a ton of free help for QGIS on the web. Start with the software's website (www.qgis.org) and their “Users Corner” located here:http://www.qgis.org/wiki/Users_Corner#How_to_use_QGIS

The QGIS v1.4 Users Guide is linked from that site but also here:http://download.osgeo.org/qgis/doc/manual/qgis-1.4.0_user_guide_en.pdf

The below instructions will guide you through starting a new QGIS project and adding vector and raster data to the project and printing a map created in the map Composer. Some more advanced topics are covered in part II. You will primarily be using Shapefiles to make maps with QGIS. Shapefiles are the most widely used and accepted GIS data format although not the best in which to store relational GIS data. But in Open Source software such as QGIS it is the simplest data format to use and edit and shapefiles are also the end product of using the GPS in the field. Moving relational data to a Relational Database Management System (RDBMS) such as PostgreSQL/PostGIS, SQL or Oracle in ArcSDE/ArcGIS is recommended but takes more time and expertise to create and manage.

1. Creating a new map project with a new empty map. a) Start QGIS (use the desktop shortcut or goto: Start > Programs > Quantum GIS)b) Start using QGIS with a new empty map - New Project button. (QGIS projects have the file

extension .qgs)

2. Add data to map . In QGIS, it is better to add Raster data first because of projection issues. There are buttons on the top toolbar to add many types of data including Vector, Raster, WMS, PostGIS, Grass, etc.

a) Hover over the buttons on the top toolbar until you see the one that says Add Vector Data. The vector data format most commonly used is the shapefile (file extension .shp). The next button to the right, Add Raster Data is used to add aerial imagery and other Raster datasets such as Digital Elevation Models (DEM).

b) Under the Dataset Source, click Browse and navigate to the location of the data you would like to add to the map (For example, C:/GIS_data/Water_Sewer/Data).

c) Select the desired data and add to the empty map (You can select multiple shapefiles in the same directory by Ctrl-clicking). Each layer will get added to the left side of the QGIS window in what is called the Table of Contents (TOC).

1

Page 2: Quick-start QGIS Tutorial

d) Imagery and other raster data should be added first, if possible. Add aerial imagery by selecting the Add Raster Data button. Raster data usually gets automatically placed underneath any existing datasets in the Table of Contents, but if it doesn’t you can change the vertical positioning of any data layer by dragging and dropping it where you want. (Data layers draw from the bottom to the top of the TOC.)

e) Turn the display of data layers ON or OFF by checking the box to the left of the data layer name in the Table of Contents.

f) To open the Attribute Table of a layer, right-click on the layer in the TOC and select Open attribute table. Check out what each layer's attributes contain.

g) To change the symbology of a layer, either double-click the layer's name in the TOC to open the layer Properties, or right-click and select Properties.

h) To start editing the layer, right-click the layer and select Toggle Editing (we will get to editing later).i) To remove a layer completely from the project, right-click on the layer's name and select Remove

3. Moving around in QGIS. a) All of the tool buttons on top of the QGIS window are part of particular toolbars. To view the names of

the toolbars, and to check them on/off of the display, goto: View > Toolbars > check the ones you need to use if they aren't already on by default.

b) You can move these toolbars around (drag and drop) and dock them elsewhere to maximize work space.c) Practice using the navigation tools in the toolbar seen below. From right to left they are:

Pan, Zoom in, Zoom out, Zoom to full extent of data, Zoom to selected features, Zoom to Layer's extent, Return to previous extent, Go forward one extent, Refresh map.

d) To determine what a tool does, place mouse over it and read text displayed (this text is the “Tool Tip”). e) If you have a lot of data displayed, you may need to refresh the view every once in awhile by clicking on

the Refresh button.f) You can zoom to a particular layer by right-clicking > Zoom to Layer or by selecting the layer in the

TOC and clicking on the Zoom to Layer button.

2

Page 3: Quick-start QGIS Tutorial

4. Changing the way data is displayed a) Add Boulder County Parks and Open Space Trails (Trails_bcpos.shp) to the map project. In the Table

of Contents, right click on the trails layer and go to Properties (you can also just double-click on the layer’s name to get to the properties).

b) Click on the icon in the left sidebar that says Symbology. You can change the pattern, color and width of the lines now, or change the symbology from a single symbol to symbolize several unique values for the different trail types. Play around with the symbology to see what everything does in the map window.

c) Add and change the symbology of Lakes. Try changing both the outline color and the fill color. d) You can also change the transparency of polygons if you wish to see a hillshade or imagery through

them. Double-click to get the Properties of the Lakes layer, select the Symbology menu, and slide the Transparency ruler over to 50% and click OK.

e) To display polygons as simple lines with no fill color, choose the “hollow” symbol and change color of the outline. Double-click the Lakes layer to get its Properties and select None for the Fill Options. You will also want to increase the Outline width and change the outline color.

f) To display unique values of the data, go to the Properties Symbology of the Trails layer. Choose Unique Value under the Legend Type drop-down menu. Under the Label field, choose Type, then click Classify. The lines will be displayed with different colors that you can change the display of as well as turn them on and off by selecting the class and clicking the Delete classes button. These can be added back in as well by clicking on Add Class. You can also play with the color scheme by using the Randomize Colors and Reset Colors buttons.

3

Page 4: Quick-start QGIS Tutorial

5. Customizing the Table of Contents (TOC) a) You can change the name of the data in the legend by right-clicking on the layer name and selecting

Rename, or changing the Display name under General in the layer Properties.b) Expand/minimize each Layer in the TOC by clicking on the plus/minus sign on the left side of the

layer's name.c) In the layer Properties, view the Metadata menu to see the source/file path or location of the data, what

spatial projection the data is in, etc.

6. Saving your map project. It will be saved as a QGIS document with the *.qgs file extension (in ArcGIS projects have a .mxd extension).

7. Printing and Exporting your map project .a) Goto the File menu and select New Print Composer. This will open up a new blank window where you

will create and edit the layout of your map.b) This Print Composer is directly linked to the map project currently open. Click on the Add new map

button:

and drag a box of the size of the map you would like to create in the blank map space of the Print Composer. A map will be drawn with what is active in the map project. c) On the right side of the Composer window is where the page size, orientation, and other formatting items can be changed. Under the Item tab, there are a set of folders located at the bottom right where other map formatting items can be changed such as the background color and whether or not a grid will be added to the map.d) Numerous map items such as a scale bar, legend, label, arrow, can be added using the Layout menu in the Composer. Once you click on the item to add in the menu, you will have to draw a box or line to indicate where the item is to be placed within the map window. The details of the layout item can then be edited in one of the tabs on the right side of the Composer window.e) To export the map to a JPG or PDF, goto the File menu and select the one that exports your desired format (Export as Image, Export as PDF). You can either print the exported map or select Print from the File menu.

4

Page 5: Quick-start QGIS Tutorial

Quantum GIS Training: Part IIUpdated 08/05/10

1. Examining layer attribute tables a) To view the table associated with the data, right click on the layer and select Open Attribute Table or

select the Layer in the TOC and click on the Attribute table button seen below (4th button).

b) Fields (columns) can be sorted by ascending or descending values by clicking on the field header.c) The table can be left open and just minimized if you will be working with it a lot by double-clicking the

table border which docks the table in the map window. This can be done for any floating window in QGIS.

d) Similar to Excel, you select a record in the table by clicking the row number at the far left of the table. Multiple records can be selected by Ctrl or Shift-clicking.

e) To see your selected records on the map, click the button in the toolset immediately below the docked table that is called Zoom map to selected rows. There are a few other options to choose from that you should check out.

f) You can also select a feature from the map by first clicking on the Select Features button (second button seen below) and then clicking on the feature. The feature you selected will become highlighted in bright yellow. You can then view that feature's record in the table.

g) To save the selected sub-set of features to a new shapefile, select the features and then right-click the layer in the TOC and select Save selection as... and name the new shapefile.

h) An important tool that is used often to select features that intersect features within another layer is the Select by Location tool found under the menu item Vector > Research Tools. There are many more Geoprocessing tools under the Vector menu to play with such as Clip, Intersect, and Buffer. We will go over some of these later.

5

Page 6: Quick-start QGIS Tutorial

i) To Identify a feature select the tool with the arrow next to an “i” in a blue circle (left-most tool seen above) and click on any of the features in your map window. In order to Identify a feature, you must have the correct layer selected in the TOC. Info on the particular feature will be displayed in a new window (which can be docked by double-clicking it).

2. Labeling Features (label and text annotation tool):

a) In the Table of Contents, right click on the layer that has the features you wish to label, then click on Properties.

b) Click on the Labels icon on the left and select the Display labels checkbox. c) Under the Label Properties tab, choose the field from your table which you wish to label features from

Field containing label. You can also change the font size here as well as mess around with the Placement Properties, give the labels an outline or “halo” or make scale-dependent labels. When finished, click OK. You have defined how QGIS will label the features (if there is incorrect or absent data in the Attribute Table, this will be reflected in the labels on the map.)

d) The labels may not be placed ideally to suit your purposes, and you may want to edit them in some way. e) Instead of labeling features automatically, you can use Text Annotation tool to manually add text to label

features. Unlike with auto-labels, you can move text annotation around and you can also double-click on the label and edit the text itself or delete labels that are not needed.

3. Metadata: a. Metadata is data about the data. Most people don't spend the time creating metadata because it's tedious

and time-consuming, but it's probably one of the more important things to do as it documents what others need to know about the data if you were to forget or leave the data via leaving a job.

b. Open a layer's Property dialog box and view its Metadata (see image below). Here you will see information about the data layer such as its spatial reference system. You can change the spatial reference system as well in the properties dialog under the General menu by clicking on the Specify CRS button (CRS = Coordinate Reference System). *DO NOT change the CRS unless you know the projection information of the layer is different than what is already specified in the metadata.

6

Page 7: Quick-start QGIS Tutorial

Geoprocessing tools : (Vector > Geoprocessing Tools) Geoprocessing tools enable us to ask questions of the data and how features and layers relate to each

other. The most commonly used tools are found in the fTools and GDAL toolsets found under the Vector (fTools) and Raster (GDAL) menus which should be loaded by default in QGIS v1.5. There are hundreds of other tools that can be loaded as Plugins to QGIS from the Plugin menu (Consult the QGIS manual for adding plugins). We will just go over the three most used Vector tools here.

1. BufferThis tool puts a buffer around a point, line, or polygon of a set distance. If you buffer a point with a distance of 100 feet, the resultant shapefile will be a polygon with a 100 foot radius. This tool is very useful for selecting features from another layer that are within a given distance of the buffered feature. For example, if we were to buffer water meters by 100 feet and then use the Select by Location tool to select all parcels that intersect with the buffered water meter shapefile, the GIS would highlight/select all houses or parcels that fall within 100 feet of a given meter.

2. ClipClipping on feature to another is a common geoprocessing function. If you would like to know what water lines fall within what parcels in a given town, you would use the Waterlines layer as your Input layer and the Parcel layer as your Clip layer. This will create a new shapefile with only those waterlines that were found within the features of the parcel layer. There will be no attribute information carried across for the Clip layer (Parcels) using the clip tool. If you need attribute information carried across to the new shapefile from BOTH layers, use the Intersect tool.

3. IntersectThe intersect tool is used when you would like to know the spatial location and attributes of one features within one layer that completely are found within or intersect another feature layer. The attribute table will contain all fields/columns from both attribute tables of those features that intersect.

Data Management Tools (Vector > Data Management Tools)1. Merge (Merge Shapefiles to one)

Merge is used to combine multiple shapefiles into one shapefile and will only work on features of the same geometry type. It doesn't consider attribute table differences – it just combines them regardless if they have the same attribute table field names (structure or schema). Therefore, it can create an unruly new attribute table that will need to be edited unless the shapefile's schemas are the same (this should be no problem if importing data from GPS using a data dictionary).

7