<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">2014-07-29 22:51 GMT+02:00 Loic Duros <span dir="ltr"><<a href="mailto:loic.duros@gmail.com" target="_blank">loic.duros@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">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.<br>
<br>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.<br>For reference, this is the full command I am running:<br>
osm2pgsql -c -d mapdatabase -U myuser -W --slim -C 18000 -k --flat-nodes=/var/planet/planet_nodes.cache --number-processes 4 -v<br><br>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 build.<br>
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, ...)<br><br>The PostGIS in Action book has an interesting example of query:<br>
"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<br>
the geometric intersects function as the join operator and geometric intersection as<br>our output function. The output of that query would be those portions of all highways<br>within the state of Utah."<br><br>Is such a query doable with the postgis database generated by osm2pgsql?</div>
</blockquote><div><br></div><div>Yes</div><div><br></div><div>It is not designed for that, but I regularly use it that way.</div><div>Be aware that osm2pgsql does not keep all OSM data and tags. This is controlled by the style file (or style LUA script) during import.</div>
<div>Be aware also of the map projection. By default osm2pgsql will reproject OSM lat/lon into web mercator coordinates. Doing real distance based queries will require reprojection...</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">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?<br>
<br></div></blockquote><div><br></div><div>The flat-nodes file is only used during import and diff update process. It is just a raw storage of lat/lon without any other detail.</div><div><br></div><div>Once osm2pgsql has processed OSM data, you have 4 tables containing geometries (points, lines, polygons + roads which is a light version of the line table using for the first zoom level of rendering).</div>
<div>In the "slim" tables (nodes, ways, rels) you have no geometries, and postgis queries are useless on them.</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">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.<br>
<br></div></blockquote><div><br></div><div><br></div><div>TileMill is a GUI on top of Mapnik. Use TileMill to create your style, then export it as an XML mapnik file to use it directly with any mapnik enabled software (like mod_tile/renderd).</div>
<div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Thank you for your interest and for your guidance.<span class="HOEnZb"><font color="#888888"><br>
<br>Loic Duros<br></font></span></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr">Christian Quest - OpenStreetMap France</div>
</div></div>