Graphics Reference
In-Depth Information
gram, type or copy and paste it into the console's script editor, save the file, and click on
the
Run Script
button (or press
Ctrl
+
Shift
+
E
). Here's an example of what the pro-
gram's output looks like:
Antigua and Barbuda: polygon of area 549 square kilometers
Algeria: polygon of area 2334789 square kilometers
Azerbaijan: polygon of area 86109 square kilometers
Albania: polygon of area 28728 square kilometers
Armenia: polygon of area 29732 square kilometers
...
Jersey: polygon of area 124 square kilometers
South Georgia South Sandwich Islands: polygon of area 3876
square kilometers
Taiwan: polygon of area 36697 square kilometers
Total length of all line features: 0
Total area of all polygon features: 147363163
Tip
This output was produced using the World Borders dataset, available at
ht-
tp://thematicmapping.org/downloads/world_borders.php
.
This is a useful set of geospatial
data, which provides simple world maps and associated metadata. If you haven't already
done so, you should grab yourself a copy of this dataset, as we'll be using this shapefile
throughout this topic.
As you can see, it is quite possible to create Python programs that read and analyze geo-
spatial data, and you can run these programs directly from within the QGIS Console. It is
also possible to create and manipulate geospatial data sources using the PyQGIS libraries.