1

I want to import an OSM file into my PostGIS database using osm2pqsql. My input .osm file has around 300,000 nodes, but the planet_osm_point table ends up with only around 50,000 records. On closer inspection, it looks like only nodes with certain tags get imported. Nodes with just the ID and lat, lon don't get imported into the table (example given below)

<node id="1497891" lat="43.7268948" lon="-79.3299196"/>

If the node has additional tags, like <tag k="highway" v="traffic_signals"/> or <tag k="permissive_left_turn" v="n"/> it got imported fine

I was using the default style file, and my command was using

osm2pgsql -c -d databasename -U username -H localhost -S style_file_location osm_file_location

I tried looking through the manual, and maybe using hstore could help, but I couldn't figure it out

Edit: It looks like there's supposed to be a table called planet_osm_nodes that stores every node, but I don't see it. Planet_osm_point versus Planet_osm_nodes for querying places

6
  • Could you list all tables in the schema with \d ? Apr 16 at 1:24
  • Just the normal default tables and views: geography_columns, geometry_columns, planet_osm_line, planet_osm_point, planet_osm_polygon, planet_osm_roads, spatial_ref_sys. Apr 16 at 3:55
  • Could you try slim mode? Apr 16 at 4:04
  • Thanks for the suggestion. Tried it, it loads all the nodes into the planet_osm_nodes table with just the "ID" "Lat" and "Lon" attributes. I should have specified I want all these nodes loaded with a "geom" attribute as well in my question, since I'm trying to map these. I can probably figure out a way to add a geom column and convert to SRID 3857 but it seems like there should be an easier way. Apr 16 at 19:27
  • Aren't those the nodes that are combined into ways/polygons?
    – JGH
    Apr 17 at 14:25

1 Answer 1

0

You're using the C transforms, which only load data specified. You should be using the modern flex transforms, or at least pgsql backend with lua transforms so you can control what data goes into the tables.

Unfortunately, it doesn't help your use case. osm2pgsql is designed for rendering and analysis of OSM data, not more internal information like untagged nodes. For what you want, you should use osmosis, pyosmium, or some other database loader, not osm2pgsql.

Your Answer

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

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