Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I'm using osm2pgsql to populate a North America OSM database from planet.osm.

I like how simple the resulting PostGIS schema is, but I'm a bit confused by its contents.

I have the two tables planet_osm_roads and planet_osm_line. I assumed that planet_osm_roads contained all the highway data, but then discovered that it only contains a fraction of the roads in some of the 'highway' types.

For example, planet_osm_line has over 12,000,000 lines with a 'highway' value of 'residential'. However, planet_osm_roads has only 2,000. By comparison both tables have the same number of 'motorway' features. Looking at the data I can't tell why some features would be in the one table but not the other.

I'd really like to see the rules the osm2pgsql uses to direct line features into each table.

I tried looking through the osm2pgsql source code to shed light on the mystery but so far I've not found what I'm after.

Any suggestions very welcome.

share|improve this question

2 Answers 2

up vote 2 down vote accepted

planet_osm_line: contains all imported ways planet_osm_point: contains all imported nodes with tags planet_osm_polygon: contains all imported polygons. Relations seem to be resolved for that. planet_osm_roads: contains a subset of planet_osm_line suitable for rendering at low zoom levels. planet_osm_line contains too many elements to render on overview maps.

use osm_line

For a good example visit - http://www.opencyclemap.org/?zoom=5&lat=39.98469&lon=-99.18887&layers=B00 which shows the routes/ways colour coordinated.

source http://wiki.openstreetmap.org/wiki/Osm2pgsql/schema#Tables_Created

share|improve this answer

planet_osm_roads contains only ways that are used for rendering low zoom levels, such as motorsways, rivers, etc. It does not contain details like residential roads, streams and various other features normally rendered only at high zoom.

The default c-based definitions of what to add to the roads table are tagtransform.c

If you want to customize this, you're probably best off writing a lua tag transform. For an example, you can see style.lua, the sample lua tag transform.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.