liste

Bonjour et bienvenue dans mon site ! Willkommen auf meiner Seite! welcome in my homepage! http://assistance-en-sig.blogspot.com/ SIG ; Bases de données ; Géomatique; Python; ArcGIS; QGIS;

recherche

Wednesday, October 31, 2012

GIS Training with QGIS - Exercise 5: Using the Field Calculator


1. Load OSM layer
a) From the directory Geodata\vector\OSM load the OSM vector layer.
b) In Settings->Project Properties choose the CRS Pulkovo(1948) EPSG:3330. Verify
that the units are set to meters. Be sure to check the “Enable on the fly” checkbox. Use the
“Zoom Full” button to zoom back to the OSM layer.
2. Edit new polygon layer.
a) Create a new vector polygon layer. Add two attribute columns: FarmerName as text and
AreaSqm as a whole number. Call the new layer Fields, and save in the
Geodata\Fruitfly directory.
b) Start editing the new layer, and digitize four or five new polygon fields on the map. Enter a
farmer's name in the Farmer_Name column for each field. When you're finished, stop
editing.
c) Open the layer's Attribute table and click the Edit button. Now click the Field Calculator
button, to start the Field calculator. Check the Use existing field option and select
the AreaSqm field. Then click the Area button. Stop editing and close the Field
calculator. Examine the results and close the Attribute table.
3. Create a spreadsheet data table.
a) Using Openoffice.org or Excel create a table with two columns: Farmer and Yield. In the
Farmer column enter the exact same names as in the polygon shapefile attribute table. In
the Yield column enter some numeric values.
b) Save the spreadsheet as a dbf file, yields.dbf in the Geodata\Fruitfly directory.
4. Field Calculator
a) Now, back to QGIS, select the menu item Vector->Data Management->Join
Attributes. Select the Fields shapefile as the target, and the FarmerName column as
the target join field. Click the Join dbf table radio button, and browse to select the new
yields.dbf file. Use the Farmer column as the Join field. For the output shapefile, click
browse and enter the name farmer_yields.shp into the Geodata\Fruitfly directory.
After clicking OK answer Yes to add the new shapefile to the map.
b) Select the new farmer_yields layer in the table of contents, and open its attribute table.
c) Begin editing and click the Field Calculator. In the New Field section enter
Yld_per_Ha as the Output field name. Set it's Output field type as Decimal
number.
d) Now using the available fields and the operator buttons, create the following expression in
the lower Field calculator expression window:
( Yield / AreaSqm ) * 10000. Click OK to run the calculation.
5. Display using Graduated symbol.
a) Open the Properties window, Symbology tab, for the farmer_yields layer.
b) Select to display using Graduated symbol. Choose the Yld_per_Ha column as the
Classification field, and choose Number of classes equal to the number of polygons in
your farmer_yields layer. Now click the Classify button, and click OK to examine the
results.

No comments:

Post a Comment