Here are a few quick references for getting started with QGIS. All steps included are based on a 2.2.0 Valmiera installation of QGIS
Tips:
- Install the “Table Manager” plugin to modify the attributes table (i.e. field names etc.)
- Use the Field Calculator to create new fields and transform values from string to text. this is useful when you only have to change 1 or 2 fields
- Use a .csvt file to define the data types for each field in a large CSV file. The .csvt file should only contain 1 row with “String” and “Integer” values used to represent each column in your .csv file. The .csvt file should be in the same directory as your csv and will be used by QGIS when you join the data to a shape layer.
Managing Projections
Sometimes when you load a shape file the layers won’t line up. When this occurs either the projection hasn’t been set or it is using a different coordinate system. Making sure that the projections used for each layer and the project is important and often resolves this:
Checking the projection used for the project: In the lower right corner of the QGIS desktop there is a box labelled “Render”. Immediately to the right of that there is a small spherical icon – click on this icon
- In the “Coordinate reference systems of the world”:
- Scroll down to “projections”
- Select “NAD 83/UTM zone 17N”
Checking the projection used in each layer:
- Right click on the layer
- Click on “Set layer CRS”
- Select the Projection of interest (in the case of southern Ontario, NAD 83 zone 17 is what I tend to use)
- Repeat these three steps for each layer that is included in the project
Building a query (selecting by attributes)
Queries in QGIS use the same syntax as SQL:
- Click on “Layer” in the top menu bar
- Select “Query” (or CTRL F)
- Create your query either by typing it directly into the “Provider specific filter expression” or by double clicking on the elements. Queries usually take the form of “Field” “Operator” “Value”. For example ID > 0
Joining Data (csv) to a shape file
- Open your shape file (Layer>Add Vector)
- Open your data file (Layer>Add Vector)
- Open attribute of your shape file (right click on shape file> Open Attributes)
- Confirm name of the primary key
- Close attribute table
- Open the properties of your shape file (right click on shape file> Properties)
- Click on “Joins” tab
- Click + button to add a join
- Select the .csv file that is to be joined with the shape file
- Confirm the Join field and Target fields are correct
- Click on OK or Apply
- Right click on the shape file and “Save As”
Spatial Joins
- Open the polygon and point files
- Click on “Vector” > “Data Management Tools” > “Join Attributes By Location”
- The “Target Vector” is the shape file that you want the new data attached to (in this case a polygon file)
- The “Join Layer” is the shape file with the attributes you want copied (in this case the points file)
- Type in a filename and location for the new files that will be created