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

osm data attributes are incomplete after loading into Postgres database

0

Hi everyone, I am new to open street map, I'm trying to download osm data, load in into Postgres database, and add a postgres layer in QGIS. The problem was that I found that the layer's attributes table are incomplete in QGIS, I guess 80% of the attributes are null. I downloaded whole australia data in format of .pbf from geofabrik, then using osm2pgsql to put the data in Postgres database (followed tutorial in LearnOSM, http://learnosm.org/en/osm-data/osm2pgsql/#importing-the-data). I think it maybe something wrong with the default.style file but I don't know how to fix it. I hope someone can help with this, and sorry about my english. :)

asked 12 Apr '15, 04:57

qiqiqi's gravatar image

qiqiqi
71235
accept rate: 0%


2 Answers:

2

It is completely normal that for most objects, most columns are null. For example, there might be columns for name, opening hours, reference number, oneway, max speed and so on - how else would they be filled for a post box, or a tree? If you dislike the many "null" columns, have a look at the "hstore" facility that osm2pgsql offers, where it is possible to import all values into a single column; you might want to get rid of some column definitions in default.style then.

answered 12 Apr '15, 09:42

Frederik%20Ramm's gravatar image

Frederik Ramm ♦
82.5k927201273
accept rate: 23%

Thanks for answering:)

(12 Apr '15, 11:56) qiqiqi

1

Nothing wrong there. null is used to signify that "this object does not have this tag", e.g. "There is no name tag for this road in the OSM database". Since osm2pgsql stores all points in one table, and all lines in another table, and all polygons in another table, it has to merge all the OSM objects together. Roads are stored next to footpaths. Building outlines are stored alongside lakes. Buildings will have a building tag (and hence have a non-null value for that column), whereas lakes will not have a building tag, and have null for that column.

answered 12 Apr '15, 11:33

rorym's gravatar image

rorym
5.4k1449100
accept rate: 11%

OK I got it, thank you very much

(12 Apr '15, 11:56) qiqiqi

Source code available on GitHub .