Graphics Reference
In-Depth Information
As you can see, our base map is a bit small right now. You can use the various panning
and zooming commands in the toolbar at the top of the window to make it bigger, but let's
use Python to do the same thing:
iface.zoomFull()
This will expand the base map to fill the entire window.
Now that we have a base map, let's add our two vector layers to the project. To do this,
type the following:
layer2 = iface.addVectorLayer("/path/to/ne_50m_urban_areas/
ne_50m_urban_areas.shp", "urban", "ogr")
Once again, make sure you replace /path/to/ with the full path to the
ne_50m_urban_areas directory you downloaded earlier. The urban areas shapefile
will be loaded into the QGIS project and will appear as a series of colored areas on top of
the base map. Let's zoom in to an area of California so that we can see what this looks like
more clearly. To do this, type the following commands into the Python Console window:
Search WWH ::




Custom Search