Earlier today i was challenged by MCantow to solve a airphoto with the overpass API. Although i know it is possible to solve the quest, i was not able to do so. To solve it i had to use QGIS. In theory both are working with the same data and same methods. Only the query language is different. And because i’m not a master in the overpass API language i could not figure it out. So here i go in QGIS.
Quest
Identify features
Before we can use QGIS and the OSM data, we need to identify features on the map. A few things can be found: a church, 2x parking lot (1x guessing next to a supermarket), 6 streets with approximately 50 houses.
Most of the aerial images are shot around 10:00–16:00 → which indicates that due to the shadows this image could be oriented north (possible). Furthermore a lot of Land Registry companies (like the Bundesamt fur Kartographie und Geodasie) print their maps north oriented. So in this case i take a gamble to say that this map is also oriented north.
Distance’s
In order to create a query that finds churches near parking lots i need the distance between the church and the parking lot. So lets find out the distance:
The distance between the 2 parking lots can also be calculated.
The curch within 200m of a parking lot, and that parking lot within 100m of another parking lot can be a unique situation. However this is probably not enough for now. In order to make use of the calculated distances we want to create a buffer around the church, but that buffer needs to point to the parking lot, and nothing more. QGIS can create wedge buffers. Wedge buffers are buffers that can be manipulated, see picture below.
For a wedge, you need to know the outer distance, the inner distance, the starting azimuth and the ending azimuth. So we need to determine the azimut’s of those features.
You can use PowerPoint to determine the azimuth. Paste the image into PowerPoint. Draw a horizontal line. Next click the rotate button. When the parking lot and the church are aligned your angle is given. Keep in mind that the azimuth in PowerPoint starts at the 3 o’clock position and turns counter clock wise.
We need to do this also for the 2 parking lots.
QGIS
So lets put QGIS to work. To do this i downloaded the OSM map of Germany and loaded it into a SQLite database.
There are 2 types of geofeatures that are for sure. The church and the parking lot. So lets extract those out of the OSM dataset.
In order to export the churches, we need to select all the churches in the dataset. Both the churches and the parking lots are stored in the multipolygon file. Use the ‘select with expression’ button and type the following code:
“amenity” = ‘place_of_worship’
Do the same for the parking lot’s with the following code:
“amenity” = ‘parking’
The tool used for creating wedge buffers only takes poins. So we have to extract the centerpoints of the polygons of both the parking lots and the churches. Go to Vector → Geometry Tools → centerpoint
Now it’s time to create some wedge buffers with the plugin ‘Shape tools’. This plugin can be found in the plugin menu of QGIS. First thing to do is to create a wedge buffer that is 185–200m and 12 degree wide.
As you can see in the picture above, small areas are selected. Now let select all the parking lots that are intersecting with these buffers. Vector →Research tools →Select by Location.
After selection is done, export this layer.
At step 1 select the layer where you want to extract parking lots from. Then select all the intersection options and last select the layer that has to match the parking lots.
There is good possibility that you still have a lot of features. To narrow this list further down we are going to select the parking lots that are 100m south of another parking lot. Start with extracting the centerpoint from the just created layer. Second, create again a wedge buffer. But this time we are going to use 100m and 355–005 degree.
Then again select all the parking lots that are intersecting with the newly created wedge.
After this your dataset has been shrunken to a small list that can be searched and controlled by hand.