NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

How to correctly represent relation members in Mysql DB? I see two variants:

  1. One table "rel_member" with ordered member list of different types with discriminator column.
  2. Three tables "rel_member_rel", "rel_member_way", "rel_member_node" for each corresponding object type.

For me second variant is preferable, but does it retain OSM semantics?

asked 17 Jan '15, 22:26

ikoder's gravatar image

ikoder
11112
accept rate: 0%


Depends on what you want to achieve. Relations are ordered in OSM so if you ever plan to upload something again, or otherwise accurately represent OSM's data, you will have to retain the order of elements. In your #2, this would have to be implemented as a separate sequencing column.

For most interpretation purposes, e.g. for the drawing of routes or multipolygons, the order does not matter. osm2pgsql, for example, uses a variant of your #1 schema but instead of a discriminator column, stores all member object IDs in a linear list - nodes first, then ways, then relations - and uses only two additional integers to point to the beginning of the way IDs and the beginning of the relation IDs in that list.

permanent link

answered 18 Jan '15, 01:38

Frederik%20Ramm's gravatar image

Frederik Ramm ♦
82.5k927201273
accept rate: 23%

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×236
×21
×8

question asked: 17 Jan '15, 22:26

question was seen: 2,510 times

last updated: 18 Jan '15, 01:38

NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum