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

I'm building up working process for analysing addresses in the database. So I use osm2pgsql for import the data from pbf and append osc-files. In the following steps I take this data for generete my own optimized dataset.

For getting all ways I need, I used the planet_osm_line table where I have all non closed ways (excluding roundabouts). The documentation of the table in the schema says the following:

Additional rows are created for ways which are members of type=route relations:

  • For each relation of type=route, its ways are concatenated into "chunks" of consecutive ways
  • One row is created for each of these chunks (one or more for each relation which has members of type way)
  • The osm_id is the negative ID of the relation
  • The tag columns are filled with the tags of the relation

Since there may be multiple chunks per relation, negative IDs are not necessarily unique.

I only need ways which meens: I only need elements with osm_id>0. If I filter the data, I've found some osm_ids of twice. The documentation only says, that relations can be contained twice. But sometimes, osm2pgsql splits some ways into different chunks.

To reproduce this you can take an extract e.g. bremen:

Now I import it with default style settings:

osm2pgsql --create -s --number-processes 4 -C 3500 -H -d osm3 -U osm bremen-150207.osm.pbf

Now you can query the table:

SELECT osm_id, count(*) FROM planet_osm_line
WHERE osm_id>0
GROUP BY osm_id
HAVING count(*)>0;

You can found this element: this is a simple way, it is defined twice, in 2 chunks. Why does osm2pgsql split this way in two chunks? How can I avoid this behavior?

If I use ST_UNION() a complete way is shown without any gap.

asked 09 Feb '15, 17:12

Christopher's gravatar image

accept rate: 100%

The reason why I don't use planet_osm_roads is, that this table don't contain all needed ways: see that answer

(09 Feb '15, 17:14) Christopher

osm2pgsql has code to split up long lines. The limit is set here:

to about 100.000 Google Mercator units (roughly meters) which your ferry line might well be above.

Change the source code and recompile.

permanent link

answered 09 Feb '15, 20:17

Frederik%20Ramm's gravatar image

Frederik Ramm ♦
accept rate: 23%

Hi, this bugs was fixed? There are an option to say "not split"?

(31 Oct '18, 12:27) ppKrauss

Follow this question

By Email:

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



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "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:


question asked: 09 Feb '15, 17:12

question was seen: 5,914 times

last updated: 31 Oct '18, 12:27

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