elywedding

Hi all,
My name is elywedding and I’m new to this community.
I am currently working on my thesis, but I’m having some difficulties figuring out how the osm file is structured.
I downloaded the osm file for Belgium, and then I converted it to a postgis database using osm2pgsql.
I am supposed to build a routing application, so I should be able to select locations by coordinates, or by inserting a street name of location name.
What I don’t understand though, is how the data is structured in relation to each other.
The data is divided in 4 tables, Point, Road, Line, Polygon.
Now I figure that Point just symbolizes a POI with coordinates.
On the other hand, I don’t understand what the difference is between the Road table and the Line table, nor what the Polygon table really symbolizes.
And how are the tables linked? I just can’t seem to figure how I can find out which Points belong to which Road/Line/Polygon. (In other words, which column defines the foreign key?)
All in all, I have to say, is that I’m really confused by this.
Tnx in advance!

Welcome elywedding!

I can’t pretend to be at all technical to answer your questions - but just to check that you are aware of the gazillions of channels in OSM, and sources of documentation?

https://wiki.openstreetmap.org/wiki/Contact_channels

To my totally inexpert ears, it sounds like wiki.openstreetmap.org may have the answers you’re looking for. But you may have checked already, and I’m sure more knowledgable people will be responding soon.

Hi and welcome to OSM and the forum

Have you googled for “OSM data model”? → https://wiki.openstreetmap.org/wiki/Elements

I don’t know the structure of your PostgreSQL database but it should be similar to the OSM data-model. There should be tools to visualize the dependencies inside your PostgreSQL-Database.

In short:
The smallest entity in the data-model is a **node **which have the information of longitude and latitude.
The next higher entity is a **way **which is simply a list of nodes. If the first and the last node in the list are the same the way is called an area.
The highest entity is a relation, which is a collection of single nodes and / or ways which have something in common.

All these entities can have additional information (tags) to further describe the entity, e.g. adding highway=residential make a way to be a residential road, shop=bakery makes a node to a bakery aso.

PS: Could you please adjust the title of this thread to something like “What is the OSM data-model” by editing you 1st post? Currently the titel is you username. :wink: Thanks.

Quick reply:

  • the osm2pgsql format is not designed for routing. It is intended mainly for rendering, but is a reasonable general purpose structure.
  • it can be used for routing using the pgrouting package, but is suboptimal
  • for a basic routing approach for motor vehicles I’d look at Graphhopper
  • there are some specific tools to build pgrouting databases in PostGIS from OSM data. I’ve used osm2po which I like because it has simple to understand configuration files

Hello Elywedding,

there are at least 2 people in the Belgian community that have a lot of experience with routing. They are not active on this forum, but I’ll ask them on the Riot/Matrix channel for Belgium to contact you

Hey there,

Where are you based? I pass by Brussels and Ghent quite often, we can have a talk in person.

Also, please state what your thesis is supposed to be researching. Are you gonna write a route planner from scratch? Are you supposed to do user testing? What would the novel thing be on your thesis?

There are a ton of tools out there already and building a route planner is a thesis onto itself (souce: my colleague did exactly that as thesis).

Mvg, Pieter