mini map of Berlin

what

I want to build my own map of Berlin from OpenStreetMap data, so I can have my own representation of the map with only the things I need.

structure

PBF file – binary format that encodes a database with map entities.

To see what’s inside, I would use Osmosis PbfReader.

We would need to specify an entity processor, which would iterate over all entities.

Let’s see what’s inside:

Nodes:        7,592,348
Ways:         1,253,298
Relations:    17,935
Bounds:       1
  

The main entity class could be 4 different things:

Cool. That amount is a bit too big for my machine, and I want to be able to parse it easily in the future. Let’s see further.

Entities have tags, which are key=value pairs. Let’s have a look there.

Tags: 6,226

Examples:

"recording:automated": ["yes"],
"lamp_post_material": ["metal"],
"health_specialty:obstetrics": ["trained", "yes", "main"],
"short_name:vls": ["EU"],
"end_date:construction": ["2024-11-29"],
"harbour:showers": ["yes"],
  

A lot of them, many useless.

Let’s add frequency and look at keys:

"slipway:type": 4,
"aed:note:de": 3,
"seamark:sea_area:category": 32,
"description:payment": 3,
"waterway:vehicle": 11,
"small_electric_vehicle:rental": 129,
"old_name:1897-1949": 1,
"opening_hours:source": 1,
"payment:nfc": 3,
"seamark:notice:2:function": 21,
"courthouse": 2,
"goods:conditional": 4,
  

Let’s filter all < 10,000:

...
"source:width": 11,264,
"kerb": 50,431,
"public_transport": 16,588,
"sidewalk:both": 30,431,
"lamp_type": 18,596,
"support": 17,149,
"parking:right": 23,533,
...
  

retrieval

Let’s filter tags by building and highway tags, keep track of nodes with those tags, and save ways depending on the tag as either building or road.

Tada!

Screenshot of Berlin Map Processing

This is an extremely heavy and slow approach; vector data at the moment is around ~200 MB JSON.

Will continue next time with optimizing it a bit.