This is a static archive of our old OpenStreetMap Help Site. Please post any new questions and answers at community.osm.org.

osm2pgsql builds ways table but not line table

0

I'm trying to import xml data from an overpass query into postgres. Using the latest windows build on appveyor, "osm2pgsql -c -d postgis_25_sample -U postgres -H localhost -P 5432 -S default.style "myData.osm" -W -s" completes successfully. While it builds the osm_nodes, osm_point, and osm_ways tables correctly, the osm_line table is empty.

The data looks something like this: https://paste.ee/p/iUUdg Is something wrong with the data or is it something else?

asked 15 Jun '19, 02:48

shinyburger's gravatar image

shinyburger
16113
accept rate: 0%

edited 15 Jun '19, 02:59

Does your data actually contain anything that would be imported in to osm_line? For example non-closed ways that are not part of a MP?

(15 Jun '19, 11:26) SimonPoole ♦

Yes. I'm sure. The polygon table is empty as well.

(17 Jun '19, 02:06) shinyburger

One Answer:

1

Your data is not NWR (Nodes, Ways, Relations) ordered, I don't believe you will get any kind of consistent results without doing that (I'm actually surprised that it imports at all).

PS: I discussed this with the osm2pgsql maintainers, and to be exact: osm2pgsql doesn't require overall nwr ordering, but it does require nodes referenced by ways to be before the ways that reference them (in practical terms this naturally doesn't really make a difference).

answered 18 Jun '19, 14:17

SimonPoole's gravatar image

SimonPoole ♦
44.7k13326701
accept rate: 18%

edited 19 Jun '19, 08:48

Source code available on GitHub .