Difference between revisions of "Talk:QGIS Tips"

From Tuflow
Jump to navigation Jump to search
Line 58: Line 58:
 
== Alternate method for generating grid from points ==
 
== Alternate method for generating grid from points ==
  
Tested on QGIS 1.8.
+
Tested on QGIS 1.8.<br>
 
Install the Sextante plugin, this is a useful tool that incorporates the modules from many other open source GIS packages into Quantum.  You will also need to install Saga and set the path of the Saga executable in the Sextante options and configuration menu (under analysis in QGIS).
 
Install the Sextante plugin, this is a useful tool that incorporates the modules from many other open source GIS packages into Quantum.  You will also need to install Saga and set the path of the Saga executable in the Sextante options and configuration menu (under analysis in QGIS).
  

Revision as of 13:20, 7 August 2012

How to Update a Column (Equivalent of MapInfo Update Column)

To quickly enter the "f" (multiplication factor applied to the boundary values) attribute for all CN type boundaries


1. Open Attribute Table

2. Select all CN attributes, this can be achieved if you sort by type so that all CN attributes are grouped,alternatively, for more complex situations, use the Advanced Search tool in the bottom right. This allows you to select using an SQL Query

3. From the attribute table, open the field calculator (you need to be editing to open the field calculator)

4. Ensure that "Only update selected features" is turned on, and set the "Update existing field" to "f"

5. Type "1" into the "Field calculator expression" box and hit "OK". Note, if you want to insert a string such as 'S' you need to enter it with the inverted comma.

FieldCalculator.jpg

Done!


You can also use the field calculator for more advanced tasks, for example when naming the Source attribute for XS, the expression

'XSName'||rownum*50-50||'.csv' **NOTE** Do not copy and paste the expression to the left into QGiS - it has to be typed within the QGIS interfac. Do not type the "||" character either, at the time of writing this operator has to be selected from the available operators in the field calculator.

will generate in the source column:

XSName0.csv

XSName50.csv ...etc

Extract Cross-Sections/Elevations from 2-D Domain to .csv format

To use QGIS to extract cross sections from your DEM:

1. Draw your cross sections using the Tuflow 1d_xs file, be sure to fill in the source column.

2. Install the QGIS plug-in "profile from line" (note you may also need to install shapely - see [1]).

3. Run the plugin, it is pretty self explanatory, select your cross sections and dem, choose a suitable sampling interval.

4. Upon running the plugin, QGIGS will add a new points file to the workspace, save this as a .csv. This file will contain the source of every cross section as well as the corresponding chainages and elevations.

5. To split this data into individual .csv files in a format that tuflow can read in, download File:XSExtractor.xls

6. Follow the instructions in the spreadsheet, after exporting to individual worksheets use the Tuflow "Export Entire Workbook to csv" to obtain all the cross sections in a tuflow format.

Done!

Plot grid elevation profiles

In QGiS 1.8 the grid elevation profile can be viewed using the Terrain Profile Plugin. Select one raster for which you wish to plot the elevation (you can add more later), and using the tool, draw a line. End the line with a double click, intermediate clicks will be plotted as a vertical line, a useful feature for determing locations.

An example of comparative elevations for a 10m grid and a 2m grid are shown.


File:QGiS Elevation Profile.jpg

Alternate method for generating grid from points

Tested on QGIS 1.8.
Install the Sextante plugin, this is a useful tool that incorporates the modules from many other open source GIS packages into Quantum. You will also need to install Saga and set the path of the Saga executable in the Sextante options and configuration menu (under analysis in QGIS).

QGIS Sextante.jpg

The Saga modules should now all be available in the Sextante Toolbox.
Load the Zpt file, in the Sextante toolbox select the Saga >>> Grid - Gridding >>> Shapes to Grid module. Fill out the appropriate options,

  • attribute should be set as elevation,
  • target grid is user defined,
  • output extent you must click the three dots on the right hand side and select your point file, this will ensure that your grid has the same extent as point file,
  • cellsize I set the cell size to the same size as the grid used in Tuflow.

For more advanced options check out the other gridding modules that Saga (and Grass) offer. If you need to interpolate between points, there are multiple options availableoptions such as Tin, Kriging, Spline etc


QGIS Points to Grid.jpg