Artifact [5a9f228590]
Not logged in

Artifact 5a9f22859036a5a493e5b5c956392959b213f0f0:

Wiki page [spatialite_osm_map] by sandro 2012-05-03 11:37:33.
D 2012-05-03T11:37:33.212
L spatialite_osm_map
P 28ca83e5b1acab104931cfb7700cf3e4957c42cc
U sandro
W 3043
back to the <a href="https://www.gaia-gis.it/fossil/spatialite-tools/wiki?name=OSM+tools">OSM tools</a> main page<br><br>
<h3>spatialite_osm_map</h3>
<b><i><u>Syntax:</u></i></b>
<table border="1"><tr><td><pre>
usage: spatialite_osm_map ARGLIST
==============================================================
-h or --help                    print this help message
-o or --osm-path pathname       the OSM-XML file path
                 both OSM-XML (*.osm) and OSM-ProtoBuf
                 (*.osm.pbf) are indifferenctly supported.
-d or --db-path  pathname       the SpatiaLite DB path

you can specify the following options as well
-cs or --cache-size    num      DB cache size (how many pages)
-m or --in-memory               using IN-MEMORY database
-n or --no-spatial-index        suppress R*Trees generation
-jo or --journal-off            unsafe (but faster) mode
</pre></td></tr></table><br>
<b><i><u>Example:</u></i></b>
<table border="1"><tr><td><pre>
$ spatialite_osm_raw -o my_country.osm.pbf -d my_country.sqlite
SQLite version: 3.7.11
SpatiaLite version: 3.1.0
inserted 3047972 nodes
        166634 tags
inserted 233481 ways
        423462 tags
        3461321 node-refs
inserted 6068 relations
        14815 tags
        56617 refs
$
</pre></td></tr></table><br>
the above shown command must be invoked from the shell:<ul>
<li><b>-o my_country.osm.pbf</b> selects the OSM input file (in this case, of the OSM-protobuf format).</li>
<li><b>-d my_country.sqlite</b> selects the SpatiaLite's DB-file to be created and populated.</li> 
<li>you can eventually add any other DB-related optimization switch, if you think it will be useful.<br>
Want to learn more ? read the <a href="https://www.gaia-gis.it/fossil/spatialite-tools/wiki?name=db-optimization">DB optimization</a> short note
</li>
</ul><br>
Once the command succesfully completes its execution, you'll find a brand new DB-file just created ...<br><br>
<img src="http://www.gaia-gis.it/gaia-sins/graph-pics/db-raw.png" alt="db-raw.png" border="1"><br>
... you can explore this DB-file e.g. using <u><b>spatialite_gui</b></u> and executing any SQL query at your will.<br>
e.g. in this case we are extracting all Nodes exposing the <b><i>tourism:hotel</i></b> tag, and being inserted since April 2012.<br><br>
<img src="http://www.gaia-gis.it/gaia-sins/graph-pics/db-raw2.png" alt="db-raw2.png" border="1"><br>
this further query will extract all Ways, determining their complexity (i.e. the number of referenced Nodes) and ordering the resultset so to show the most complex Ways first.<br><br>
<img src="http://www.gaia-gis.it/gaia-sins/graph-pics/db-raw3.png" alt="db-raw3.png" border="1"><br>
this last example query will extract all Ways, checking for broken Node references.<br>
i.e. it will check if some undefined Node is referenced anyway, thus identifying the corresponding invalid Way.<br><br>
<br><br>back to the <a href="https://www.gaia-gis.it/fossil/spatialite-tools/wiki?name=OSM+tools">OSM tools</a> main page
Z 1f336cdbdf08001259e83d6d41f9d823