User:Mlvln/DiaryPost1
Learning Journey - Creating Custom Map Style from OSM Data in QGIS

Preview: So or similar could the map look like. This mock-up was made with the QGIS GUI and OSM data downloaded over the overpass api.
In this diary post, I want to show you what I am currently working on in my free time, what my motivations and inspirations were for starting the project, and what problems I have encountered. I also want to share what I have learned and what I plan to do with the project in the future.
I was inspired by the map Straßenraumkarte by Supaplex030, which shows micromapping in the urban area of Berlin-Neukölln in great detail. The map visualizes a wide range of different OSM elements such as trees, advertising columns, manhole covers, parking lots, pedestrian and bike paths, Stolpersteine, as well as lanes and their markings.
Unfortunately, the Straßenraumkarte has not been updated in a while. Supaplex030 is currently working on a new version that covers all of Berlin but has not yet been released. Therefore, I thought I would try to render the tags I am interested in myself.
Looking at the map gives me good feedback on whether I have worked correctly or if important tags are still missing, such as the specification of the surface=.

In the upper right corner next to the e-scooter parking lot, the asphalt area is not rendered correctly (the white map background is shining through). The roadway area shown here in light red is missing a surface specification in OSM. Bollards are also rendered differently depending on their material and color.

Details such as roadway markings, manhole covers, and trash bins (evaluates colour= and operator=)
So far, I have created the map using Overpass API queries for my neighborhood. However, I want to render the entire city of Berlin. I also aim to reduce my dependency on Overpass, as the servers are overloaded by scrapers. This has opened up a new learning opportunity for me to process OSM extracts (.osm.pbf files).
I started with the roadway areas. After downloading the OSM extract for Berlin from the Geofabrik download server, I run a Python script that saves all objects with the key area:highway into a new file using an Osmose command. I then import this file with another Python script into QGIS and process it there in a semi-automated manner.
Before I can further process the data from the extract as I am used to from the data downloaded via Overpass, I need to use the QGIS tool “Explode Hstore Field.” This tool converts the column other_tags, in which many OSM tags are stored as comma-separated list entries, into separate fields in the attribute table. I'm not so sure why the date is stored like this, if this is a general osm-extract thing or if it's only like this with the extracts from geofabrik, but I was happy that I could find a solution quickly by searching on the internet.
| area:highway | other tags |
|---|---|
| residential | "surface"=>"sett",... |
| secondary | "surface"=>"asphalt","junction"=>"yes",... |
| ... | ... |
| area:highway | surface | junction | ... |
|---|---|---|---|
| residential | sett | NULL | ... |
| secondary | asphalt | yes | ... |
| ... | ... | ... | ... |
In addition to a few other edits, I can already apply my styling (QGIS Layer Style File QML) from the mock up to the highway areas using a script.

All highway areas for Berlin, often still without surface tags. The blue rectangle roughly indicates the previous bounding box of my mock-up map.
I am curious whether my computer will cope with importing more and more data for the entire city into QGIS. The feature count for the area:highway objects is already just below 15,000. The count for other objects will be significantly higher. Fortunately, the data already comes a spatially indexed, which greatly speeds up the processing and display of the objects.
If everything goes as I imagine, I would like to evaluate additional objects that have not yet been rendered in my mock-up and add rules for displaying features only at specific zoom levels. Regular updates of the data should not be too complicated; I will just need to run the Python scripts. Ultimately, I will render tiles of the map. I hope then to find support for hosting and publishing the map, as this is something I have never done and not even an idea where to begin.

Preview: Area around Kottbusser Tor. It renders the subway-platforms on different layers and displays the ref of the subway entrances.