Ian Van Giesen

Writing, notes, and updates.

← All blog posts

Cookbook for Solar Cadastre using QGIS and OSM Data

Recently in class we used QGIS to create some useful Solar Cadastre pictures for analysis of solar resources. I used a combination of OSM data and data from data.grandlyon.fr for digital terrain model and a digital surface model to create the analyses. It was super interesting, because with just a little investment of time, and publicly available resources, I was able to create really neat looking reports on all kinds of solar availability metrics like sky view factor, sun hours, and sun-path animations.

Assumptions:

Cookbook

Workflow 1.1: OSM data extraction

  1. Bring in OSM as a XYZ layer. Hopefully there is already building vector data for the area of interest. You should ideally see something like Figure 1.
“OSM brought in as a XYZ layer for Lyon, France”
Figure 1: OSM brought in as a XYZ layer for Lyon, France.
  1. Build a query inside an extent using your Study boundary for city block vector layer. This query will contact the overpass-api server to request OSM data.
“Build a query inside an extent from QuickOSM”
Figure 2: Build a query inside an extent from QuickOSM.
  1. Next create a HTTP(S) POST/GET request using the same overpass-api.de URL. Use the POST method and input the code given below:
url_encode(
    map(
        'data',
        @Build_query_inside_an_extent_OUTPUT_OQL_QUERY
    )
)

The other resulting request options looked like Figure 3 for me.

“HTTP(S) POST/GET request from QGIS”
Figure 3: HTTP(S) POST/GET request from QGIS.
  1. Then using QuickOSM, open the sublayers from the OSM file that the HTTP(S) POST/GET request returns and save the vector features to file, then extract by location, using the Study boundary for city block as the comparison layer. I had to re-project the layer, since I had not already re-projected the XYZ OSM file.

Tangent - turns out the CLI utility ffmpeg does not support 32 bit, single band (in this color just the channel for gray) image, or the kind of images that this QGIS project produced.

“Shadow gif”
Figure X: Shadow gif. I just love the way this looks! I used ImageMagick to make the .gif loop.