2

What's the difference between the planet_osm_polygon and planet_osm_point tables? I find similar columns in both tables.

1 Answer 1

4

The difference is in the names: planet_osm_point contains point features from OSM, that is, nodes that have tags on them. Columns in both tables are tags, plus way for geometry.

Planet_osm_polygon contains polygons and processed multipolygons (so you don't need to collect multipolygons yourself). So, for example, building contours would be included in _polygon table, while shop nodes have to be collected from _point.

I don't know why it was decided to split points and polygons (and lines) into different tables. This probably allows disk space optimization, for tags allowed for those types of geometries are different (see default.style from osm2pgsql directory).

2
  • 1
    Well, I'd assume that has something to do with the possibility to work with the data as shapefiles. Whereas tab files can hold points, lines, polygons in one datalayer, shapefiles are distinctly only point, only lines, only polygons. For your example shop nodes: there could be a polygon to show WHERE it lies and what shape it has, but the point data with the shop name allows for a POINT dataset to be styled with icons (i.e. icons for shops, gas stations, parking lots) which would be harder to do in the polygons. Commented May 14, 2014 at 16:00
  • Don't expect that shops always are found in the nodes table. They can be stored as polygon-only in the database too. You have to build centroids from them separately.
    – AndreJ
    Commented May 15, 2014 at 7:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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