[OSM-dev] OSM data import using osm2pgsql... what's next.

Loic Duros loic.duros at gmail.com
Tue Jul 29 20:51:13 UTC 2014

I am completely new to both OSM data and PostGIS, and I have a few
questions, which I thought would be best asked in this mailing list. If you
can think of another mailing list where these questions would be more
appropriate, please let me know.

I am currently using osm2pgsql to import the planet osm data. This is
taking a while, expectedly, and I'm using --flat-nodes in order to save
space, as well as -k, which according to -h is for the hstore.
For reference, this is the full command I am running:
osm2pgsql -c -d mapdatabase -U myuser -W --slim -C 18000 -k
--flat-nodes=/var/planet/planet_nodes.cache --number-processes 4 -v

I would like to use my server later on for tile-serving purposes (using
Mapnik and mod-tile, and/or TileStache), but I would also like to be able
to run queries that give me interesting data for an Android app I will
Because I am using flat-nodes, will I still be able to make queries to
calculate distances, find points of interest (such as detecting hills
around a point, ...)

The PostGIS in Action book has an interesting example of query:
"Suppose the task at hand is to find the total length of all interstate
highways in the state of Utah. We search for two tables: one with the
polygons for all the states and one with all interstate highways in the
United States, represented as linestrings. Next we extract the polygon that
represents Utah from the states table and perform an SQL join with the
highways table using
the geometric intersects function as the join operator and geometric
intersection as
our output function. The output of that query would be those portions of
all highways
within the state of Utah."

Is such a query doable with the postgis database generated by osm2pgsql? I
understand osm2pgsql is focused on tile rendering, but I'm curious to see
how much can be done in terms of analysis with it, not just for roads but
for looking for distinct features in the environment (forest, parks, hills,
...) within a given range. Does using flat-nodes for the import limit the
capability to do spatial queries in any way?

Finally, I would also like to create a custom design for rendering tiles. I
have taken a look at osm.xml located in my local directory, and it looks
like this is the right file to override to design tiles a little
differently in terms of look and feel. However, I've also tried using
TileMill, and was wondering if this is something that can be used with
Mapnik as well.

Thank you for your interest and for your guidance.

Loic Duros
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/dev/attachments/20140729/1c0840a1/attachment.html>

More information about the dev mailing list