The Green View Index for QGIS is a plugin that performs the three main procedures necessary to calculate the GVI for a given area:
- Generating random points in an area
- Downloading Google Street View images for the coordinates of these points
- Calculating the greenness index
We are publishing a series of three articles:
1-Green View index concepts and plugin installation
2-Tutorial of the Green View Index plugin (this article)
3-Comparison of the results of the plugin and aerial photo processing
2-Tutorial of the Green View Index plugin
NOTE: At the time of writing this article (May 2023) the available version of the plugin is still an experimental version. As with any experimental version, it is recommended to use it with a long term release (LTR) of QGis, as this is the version with which the plugin has been tested. If you are using other versions, you may experience malfunctions. If this is the case, please send a small error report to the designer of the plugin, Alexandros Voukenas: firstname.lastname@example.org.
2.1-Generation of the viewpoint layer
If you already have a layer containing the viewpoints you want to use, you can proceed to the next step. However, make sure that each point in your layer has a unique identifier, as this will be needed in the second step.
If you don’t have a layer of points, you will use the plugin to generate a layer with a random sampling.
As input, you need to define what defines your area of interest (AOI).
- The first option is a polygon layer to directly define the area of interest. In this case, random points will be generated inside the area of interest, regardless of the underlying road network.
- The second option is to define a road network as input, and random points will be generated along the lines of this network (they will be snapped to the line geometries).
- The third option is to define both the area of interest and the road network as input. In this case, the road network will first be clipped to the boundaries of the area of interest, and then points will be generated along the lines of the remaining road network.
You can use your SRC of choice for the input layers. The only constraint is that if you choose to use both an area of interest and a road network, both layers must have the same SRC.
The script needs two additional parameters to work:
The minimum distance between points and the number of points to generate.
The minimum distance must be expressed in meters (regardless of the SRC of the input geometry). Also, as a parameter, it overrides the number of points to generate. This means that if you set both the minimum distance and the number of points, fewer points may be generated to satisfy the minimum distance.
The window for this treatment looks like this:
As a result you will have a new layer of points distributed in your area of interest:
2.2-Downloading the Street View images
The next step is to download the GSV images at the sample point locations.
The download window allows you to configure all the Google Street View image options.
Input sample points layer and Unique ID field from sample points layer.
The input to this script can be either the layer produced by the previous script or a dataset of your own, provided it includes a unique ID field of type “Integer”. This field must be provided as an input parameter, so that when the images are saved to disk, their ID is part of their name.
Google Street View API key
This is the key you got at the end of the previous article.
Field of View (FOV) value
In Google Street View, fov (90 by default with GSV but 60° by default in the plugin) determines the horizontal field of view of the image. The field of view is expressed in degrees, with a maximum value allowed in GSV of 120. When dealing with a fixed size viewport, as in the case of a fixed size Street View image, the field of view essentially represents the zoom, with smaller numbers indicating a higher zoom level.
60° is a very good compromise for urban images. This parameter affects the number of images downloaded, as it determines the number of directions needed to scan the full circle around the viewpoint (next parameter). With 60° you will need six directions while with 90° you will need only four.
Heading values (horizontal angle) for which to download images, separated by semicolon.
By default the directions are set to a 60° FOV. If you change the previous setting, be sure to adjust it to cover the full circle around the viewpoint. For example, if you choose a FOV of 90°, you should set the heading values to “0;90;180;270”.
Pitch values (vertical angle) for which to download images, separated by semicolon.
By default you find three view angles: -45°, 0 and 45°. You can reduce the number of view angles, for example to reduce it to a simple horizontal view (0°), but you reduce the interest of the Green View Index which is precisely to take into account the different views we have of our environment.
By default the images will have 600×600 pixels which allows a very good definition.
If the box is checked, the latitude and longitude are added to the name of the image file, so that they can be integrated into the QGis project with the Import photos plugin.
If this box is checked, the images are not uploaded. You will have for each requested image only a csv file with the status and date of the image. This way you can check if the conditions of your study are respected, without damaging your credit associated with the API key, and only proceed to the download with full knowledge of the quality of the images.
Output folder containing GSV images
WARNING! At the moment the plugin offers the standard drop-down menu, with the option to upload the images to a permanent directory or to a temporary directory. Do not choose “temporary directory”. Upload your images to a permanent directory, reserved for your AOI images only.
2.2 Calculation of the Green View Index
The third script of the plugin performs the final calculation of the Green View Index for each viewpoint of our AOI.
The first three parameters have already been defined in the previous steps.
Write green mask images.
If this box is checked, the script adds to the image directory the green/non-green processed image used for the index calculation.
The script will create a new point layer by adding to the input point layer of the first step a GVI field with the calculated value for the index at each viewpoint.
Note that the created layer will be in geographic coordinates, and not in the src of the input layer if it was pre-existing.
In the next article we will see a comparison of the Green VIew Index results compared to vertical aerial image processing.
Thank you for this