2.1. Setting up a QIGS project¶
In this workshop, we will be taking on the role of a city planner, tasked with updating the bike lane master plan of the city of Portland, Oregon.
The City of Portland maintains a site where this information can be downloaded in shapefile format. While we will not be working with this exact download, we will be working with a modified version of same. Our goal will be to update the data we have been given, with the directive that when we are done, we have a similar content that could be placed on this site for download by the general public.
If you’re interested, here are links to the original, direct downloads:
These downloads are not necessary for completion of this workshop.
We will load our data from a shapefile and work with the data in QGIS. And of course, we will make and store snapshots of our data using GeoGig.
The data has been modified from the original source, and many columns removed. Students may wish to download the original shapefile and note that many of the columns refer to an internal record-keeping method to show who made what changes and when.
Specifically, the columns modifiedby (a name) and modifiedon (a date) would be completely unecessary when used with a version control system such as GeoGig, as that information would already be encoded in the repository history.
2.1.1. Data details¶
The following is a description of the attributes contained in the data file:
|segmentname||String||Name of the area where the feature exists (Example: SW MAIN ST)|
|status||String||Whether the bike lane exists or not. One of ACTIVE, RECOMM or PLANNED|
|facility||String||Short code for the type of bike lane. One of MTRAIL (multi-use trail), BLVD (bike boulevard), LANE (bike lane) or SCONN (signed connection)|
|yearbuilt||Integer||Year the bike lane was put into service|
|comments||String||Description of the feature, if any|
2.1.2. View data¶
We will be viewing the data using QGIS.
Go to Layer ‣ Add Layer ‣ Add Vector Layer....
This will bring up the Add vector layer dialog.
Click Browse, find bikepdx.shp in the data directory and click Open.
You will see the layer displayed in the main window of QGIS.
2.1.3. Style layer¶
To improve the display and make working with our data easier, we will apply a style to our layer.
The style will show different routes based on two different criteria (attributes):
- The type of route:
- A “multi-use trail” (facility == 'MTRAIL')
- A “bike boulevard” (facility == 'BLVD')
- A regular “bike lane” (facility == 'LANE')
- The status of the route:
- An active route (status == 'ACTIVE')
- A non-active route (status <> 'ACTIVE')
With these criteria, we can generate six distinct rules for styling the different lines in the layer.
In the Layers panel, right-click on the layer entry (bikepdx) and select Properties.
This will bring up the layer properties dialog. Click Style to bring up the style parameters if it isn’t already selected.
At the bottom of the dialog, click the Load Style button and select Load from file.
In the dialog, select the bikepdx.sld file and click Open. This file is located in the workshop data directory.
By default, only .qml files are shown in the file listing, so you may need to adjust the file list to show SLD File (*.sld) or type the filename in manually.
You will see the details of the style displayed in the dialog.
Click Apply to apply the style to the layer.
Click OK. The map window will be updated, showing the new style. Note how the non-active routes are dashed, while the more “important” routes are thicker/darker.
With our layer styled, our data is now ready to be versioned. Feel free to explore the layer by zooming and panning around the map window.
Now is a good time to save your project. You should save your project periodically to prevent loss. A good name for the file would be bikepdx.qgs.
2.1.4. (Optional) Add a background layer¶
To give this layer context, you may wish to add a background layer. These steps are entirely optional and can be skipped without loss of comprehension.
We can use the OpenLayers QGIS plugin to pull in any number of standard web map layers, such as Google or Bing. The OpenLayers QGIS plugin is typically not installed in advance, so we’ll install it here.
Navigate to Plugins ‣ Manage and Install Plugins.
This will bring up the Plugin Manager.
Click Not Installed and select the OpenLayers Plugin.
Click Close to close the Plugin Manager.
Clicking the Web menu shows an entry: OpenLayers Plugin.
Select a suitable basemap. For example, the Google Physical map provides a nice contrast.
The layer will be loaded. In the Layers panel on the left, drag the entry for bikepdx so that it is on top of the background layer and is not obscured.
Table Of Contents
Boundless provides commercial open source software for internet mapping and geospatial application development. We are dedicated to the growth and support of open source software.
This work is licensed under a Creative Non Commercial-Commons Attribution-Share Alike 3.0 United States License. Feel free to use this material, but we ask that you please retain the Boundless branding, logos and style.