[Tile-serving] [osm2pgsql-dev/osm2pgsql] How to estimate disk space requirements for flex output in osm2pgsql 2.0.0? (Discussion #2262)

William Edmisten notifications at github.com
Sat Oct 5 13:01:21 UTC 2024


Hello!

I'm running osm2pgsql with a flex output for the planet file (77GB PBF). I'm running this on a VPS with a mounted volume, where I pay by the GB. I'm wondering how much space PostgreSQL needs to run:

```
osm2pgsql --create --verbose -U postgres -H localhost --slim --output=flex -S /osm2pgsql.lua /extract.osm.pbf
```

The flex output I'm using is meant to extract all restaurants (nodes, ways, or relations) from the planet.

I've done something similar by running `osmium tags-filter` with `nwr/amenity=restaurant` and the output is only ~300MB. But now that I'm running osm2pgsql directly on the planet file, I'm trying to figure out how much disk space is needed to run osm2pgsql directly.

## Appendix

/osm2pgsql.lua

```
local restaurants = osm2pgsql.define_table({
    name = 'restaurants',
    ids = { type = 'any', type_column = 'osm_type', id_column = 'osm_id' },
    columns = {
        { column = 'name', type = 'text' },
        { column = 'cuisine', type = 'text' },
        { column = 'amenity', type = 'text' },
        { column = 'tags', type = 'jsonb' },
        { column = 'geom', type = 'point', projection = '4326' }
}})

function process_poi(object, geom)
    local r = {
        name = object.tags.name,
	    cuisine = object.tags.cuisine,
        amenity = object.tags.amenity,

	    tags = object.tags,
        geom = geom
    }

    if object.tags.amenity == "restaurant" then
    	restaurants:insert(r)
    end
end

function osm2pgsql.process_node(object)
    process_poi(object, object:as_point())
end

function osm2pgsql.process_way(object)
    if object.is_closed and object.tags.building then
        process_poi(object, object:as_polygon():centroid())
    end
end
```

-- 
Reply to this email directly or view it on GitHub:
https://github.com/osm2pgsql-dev/osm2pgsql/discussions/2262
You are receiving this because you are subscribed to this thread.

Message ID: <osm2pgsql-dev/osm2pgsql/repo-discussions/2262 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/tile-serving/attachments/20241005/30be0803/attachment.htm>


More information about the Tile-serving mailing list