I'm currently importing a subsection of North America into PostGIS to render my own basemap tiles using osm2pgsql. Is there any way to get an accurate count of the number of nodes, ways, and relations contained within my PBF file that I am generating to determine how long this will take to process on my computer?
[GIS] OpenStreetMap – Determining number of nodes, ways, and relations in a PBF file
openstreetmaposm2pgsql
Best Answer
You can run osm2pgsql with null output, no RAM cache, and no slim cache. For a 2.5GB PBF extract of Canada, it took me about 37 seconds to count the nodes, on an NVMe SSD.
Note that there are two numbers, the total for this file, and the max for the OSM database.
The node count can then be multiplied by 8 bytes to get a good estimate for the cache size when you import into PostgreSQL. In this case,
327502800 * 8 bytes = 2.44 GB
. The osm2pgsql manual recommends adding 10 to 30% overhead on top of that cache value.