Green Space - Solutions

Caution

Don’t look at the hints or solutions until first making a sincere effort to solve the steps yourself. If you really get stuck, take a look at the hints and, if necessary, the solution steps, but only as much as needed to get you going again.

Tip

There are many ways to solve most GIS workflows. It is OK if you use another way to achieve a similar outcome.

Q1: Ratio of green space

Hint 1: Identify green blocks

The urban blocks dataset contains a class_2018 column, which categorizes different land-use types. To begin, extract the unique values from this column to understand the various land classifications. From these values, identify the ones that correspond to green spaces, then filter the dataset to create a new layer that includes only these green spaces, allowing for further analysis.

  • Open the Processing Toolbox, search for List Unique Values, then run the tool for the class_2018 column.

  • Open the html report to list unique values.

    Total unique values: 19
    Unique values:
    Continuous urban fabric (S.L. : > 80%)
    Arable land (annual crops)
    Isolated structures
    Green urban areas
    Construction sites
    Forests
    Discontinuous low density urban fabric (S.L. : 10% - 30%)
    Permanent crops (vineyards, fruit trees, olive groves)
    Water
    Discontinuous medium density urban fabric (S.L. : 30% - 50%)
    Herbaceous vegetation associations (natural grassland, moors...)
    Mineral extraction and dump sites
    Discontinuous dense urban fabric (S.L. : 50% - 80%)
    Airports
    Industrial, commercial, public, military and private units
    Sports and leisure facilities
    Pastures
    Discontinuous very low density urban fabric (S.L. : < 10%)
    Land without current use
  • Open the Attribute Table and use Select By Expression to select green blocks:

      "class_2018" IN (
      'Arable land (annual crops)',
      'Green urban areas',
      'Forests',
      'Permanent crops (vineyards, fruit trees, olive groves)',
      'Water',
      'Herbaceous vegetation associations (natural grassland, moors...)',
      'Pastures'
      )
  • Invert the selection and delete the selected (non-green) blocks.

Hint 2: Split green blocks by neighbourhood

Some green spaces may extend across multiple neighbourhoods, meaning a single green space Polygon could belong to more than one boundary. To address this, use a splitting operation to divide these green blocks along neighbourhood boundaries. This will allow only the corresponding portion of green space to be assigned to the respective neighbourhoods.

  • Open the Processing Toolbox, search for Vector Overlay - Split With Lines
  • Run the tool using the green blocks as the Input layer and the neighbourhood Polygons as the Split layer.

Hint 3: Recalculate block areas

Once the green spaces have been split, the block_area column must first be recalculated, as the original block areas no longer apply.

Use the Field Calculator to recalculate and update the block_area column for the new Split layer, using the $area expression (update the existing field or else create a new field with a new name).

Hint 4: Aggregate green areas to neighbourhoods

Next, perform a spatial join to assign areas from each green block fragment to the corresponding neighbourhood which contains it. Note that slight geometric inaccuracies may occur along boundaries, which may give some unexpected results when using geometric predicates. To mitigate this, first buffer the neighbourhood boundaries by 1 metre before performing the spatial join so that they fully contain their corresponding green spaces.

  • Use Vector - Geoprocessing Tools - Buffer to buffer the neighbourhoods by 1m.
  • Open Join Attributes by Location (Summary) (from the Processing Toolbox - note, we are using the version with “summary”):
    • Use the Buffered neighbourhoods layer for the Join to features in layer, and use the Split blocks layer for the By comparing to layer.
    • Use the contain predicate.
    • For Fields to summarise use block_area.

Hint 5: Join the data

Join the calculated green space ratios back into the original neighbourhoods layer.

  • Double click the original madrid_nbhds layer in the Layers panel.
  • Click the Joins tab and create a new join to the layer from your previous step, for example, Joined layer.
  • Use the matching fid columns to create the join.
  • Preferably select the Joined fields option and check only the block_area_sum attribute so that it only pulls in the necessary column.

Hint 6: Calculate green space ratio

Add a new column in the neighbourhoods dataset to store the green space ratio. This ratio represents the proportion of each neighbourhood covered by green space.

  • Open the Attribute Table and Field Calculator tool.
  • Create a new Decimal column named something like area_ratio from the ratio of green space to neighbourhood area. Use an expression such as ("Joined layer_block_area_sum" / $area) * 100 (set the column name according to the joined column name from the previous step).
  • Visualise!

Q2: Distance to green space

Hint 1: Reuse cleaned blocks layer

Reuse the cleaned blocks layer from the first task, consisting only of green blocks.

Hint 2: Interpolate perimeter points

It will be more accurate to calculate distance to the periphery of the green spaces rather than the centre-points of the green blocks; so, start by interpolating points along the green blocks peripheries. Try a distance of approximately 50m.

From the Processing Toolbox, search for Points along geometry, select your green blocks and set your distance. This will decompose the Polygons into regularly spaced Points in a new output layer. Don’t use an overly small distance – 50m is sufficient.

Hint 3: Measure the distances

Measure the distances from each street to the periphery points along the green space peripheries.

  • From the Processing Toolbox, select the Distance to nearest hub (points) tool.
  • Use your streets for the Source points layer (it will use the centre-points) and green periphery Points layer for the Destination hubs layer.
  • Use Meters for the measurement unit.
  • For the Hub points option, select the dropdown and either select the option to create a temporary layer or provide a new output file path.
  • Run the algorithm to generate a new Hub distance layer, which will contain the distance to the nearest green periphery.

Hint 4: Set contained points to zero

Notice that points inside a green block will not show zero, so these need to be set manually.

  • Open Vector - Research Tools - Select by Location.
  • Select points from the output layer from the previous step (e.g. Hub distance) that are within a green blocks Polygon using the are within predicate.
  • With the features selected, open the Hub distance Attribute Table, toggle editing, and use the Field Calculator to manually update the HubDist column for the selected features to zero (double-checking that you’re only editing selected features, not all features).

Hint 5: Join distances to streets

Join the distances to the original streets.

  • Double click the original street_network layer in the Layers panel.
  • Click the Joins tab.
  • Use the matching fid columns to create a join to your distances layer from the previous step.
  • Preferably select only the HubDist attribute (so that unnecessary columns are not also joined).

Hint 6: Visualise

Visualise using a gradient of two colours, setting your threshold (for the colour demarcation) manually. Note that if you were to use a continuous gradient instead (which you are welcome to do), you would need to invert the Green colour map because nearer distances are preferable in this case.