Quantum GIS: the Open-Source Geographic Information System
Loading shapefiles into QGIS is done by clicking the toolbar icon labeled Add vector layer, which looks like a plus sign hovering over a map; it opens a standard open file dialog. By preselecting ESRI shapefile (suffix .shp) from Files of Type, I can be sure I'm opening the right file, which is useful, because a shapefile is actually a bundle of files. As I load each shapefile, it shows up under its original name on the left under the Legend window, which acts as a sort of table of contents.
After unpacking the datasets, I load these five shapefiles in this order: allroads_161v7b.shp (roads), hydro_161v7b.shp (rivers), hydropoly_161v7b.shp (lakes), Washtenaw_Potential_Restoration_Area.shp (the name says it all) and Washtenaw_nlcd_1992.shp (land use).
Unfortunately, upon loading the shapefiles, the sum total map that's displayed on the right in the Map View window looks like a big rectangle covered with random black and green blobs and no lines. Where are the roads, lakes and rivers I loaded? One reason for the odd display and missing elements is that the layers I added first are buried under the county-wide land-use layer, which sits on top of everything else. I can begin to solve this problem by dragging the land-use layer down to the bottom of the Legend and tinkering with the other layers so they all are visible.
The other reason for the strange-looking map is that QGIS defaults to display one color for every characteristic in the shapefile. For the road layer, defaulting to one color is fine, because it is simply a collection of lines. However, layers with thousands of polygons are more complicated. All of the many land-use types default to the same color, thus creating no differentiation among them. I must give each land-use type its own unique color manually. To do so, I first right-click on the land-use entry in the legend and select Properties from the menu. On the Symbology tab, I change the drop-down menu next to Legend type from the default value of Single Symbol to Unique Value. Using the drop-down menu in Classification Field, I can select which field in the database to classify. In my case, I classify a field called GRIDCODE, which contains the code that designates the land-use code for each polygon in the layer.
How do I know which database field I should classify, as well as the meaning of each classification? To find out, I sometimes need to leave the Layer Properties menu and examine the attribute table, a display of the database containing the attribute data for the layer. For example, I can examine the attribute table of the land-use layer by right-clicking on the title in the Legend (on the main GUI) and selecting the command Open attribute table. An example of an attribute table is shown in Figure 2. The land-use attribute layer contains a field ID to designate each polygon, as well as the field GRIDCODE to classify each one. Oftentimes the attribute table also contains a field with the label for each classification. Although such a field is missing from the land-use attribute table, a separate file with classifications is found in a text file included in the downloaded dataset.
After consulting the attribute table and the file containing classifications, I am ready to continue with the classification of the field GRIDCODE back in the Layer Properties menu. Pressing the Classify button populates the window below with the unique classification codes found in the layer. I can label each classification as I wish using the "Label" field, and I can give each classification its own color with the Fill color option.
After finishing the classification, I also want to do some more housekeeping to make the Legend and Map View more useful, such as making the colors of the other layers more intuitive (for example, blue lakes) and thickening the lines designating the roads and rivers. I can carry these out also with the Layer Properties dialog (right-click on layer name→Properties). A right-click on the layer name also gives me the option to change the layer name displayed in the Legend.
Post-housekeeping, the Map View in QGIS finally takes shape. I finally can recognize features such as roads and rivers, and now that the land-use types are differentiated, I easily can tell which areas are urban, agricultural, forested and so on. Figure 3 shows the end result.
To simplify visual analysis on my map, I also applied the same color to similar land-use categories. For instance, I applied the same color to two different agricultural categories as well as three different forest-related ones. For this application, I am interested to know only whether the land use is agricultural or forested, not the specific type of each. Fewer colors makes my map less busy.
James Gray is Products Editor for Linux Journal
|Using Salt Stack and Vagrant for Drupal Development||May 20, 2013|
|Making Linux and Android Get Along (It's Not as Hard as It Sounds)||May 16, 2013|
|Drupal Is a Framework: Why Everyone Needs to Understand This||May 15, 2013|
|Home, My Backup Data Center||May 13, 2013|
|Non-Linux FOSS: Seashore||May 10, 2013|
|Trying to Tame the Tablet||May 08, 2013|
- Using Salt Stack and Vagrant for Drupal Development
- Making Linux and Android Get Along (It's Not as Hard as It Sounds)
- New Products
- Validate an E-Mail Address with PHP, the Right Way
- Drupal Is a Framework: Why Everyone Needs to Understand This
- A Topic for Discussion - Open Source Feature-Richness?
- New Products
- Home, My Backup Data Center
- The Pari Package On Linux
- Developer Poll
- This is the easiest tutorial
5 hours 22 min ago
- Ahh, the Koolaid.
11 hours 1 min ago
- git-annex assistant
17 hours 59 sec ago
- direct cable connection
17 hours 23 min ago
- Agreed on AirDroid. With my
17 hours 33 min ago
- I just learned this
17 hours 37 min ago
18 hours 7 min ago
- not living upto the mobile revolution
20 hours 59 min ago
- Deceptive Advertising and
21 hours 34 min ago
- Let\'s declare that you have
21 hours 35 min ago
Enter to Win an Adafruit Prototyping Pi Plate Kit for Raspberry Pi
Congratulations to our winners so far:
- 5-8-13, Pi Starter Pack: Jack Davis
- 5-15-13, Pi Model B 512MB RAM: Patrick Dunn
- Next winner announced on 5-21-13!