Artifact [ad80449184]
Not logged in

Artifact ad80449184efafd1b7032123576434420fed6ffa:

Wiki page [spatialite_osm_map] by sandro 2012-05-03 11:59:08.
D 2012-05-03T11:59:08.918
L spatialite_osm_map
P 5a9f22859036a5a493e5b5c956392959b213f0f0
U sandro
W 2922
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_map -o my_country.osm.pbf -d my_country.sqlite
SQLite version: 3.7.11
SpatiaLite version: 3.1.0
UNRESOLVED-NODE 114601792
...
UNRESOLVED-WAY 39764802
VACUUMing the DB ... wait please ...
        All done: OSM map was succesfully loaded
$
</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>
<u>Please note:</u> sometimes you can notice many <i>Unresolved-Node</i> or <i>Unresolved-Way</i> warning messages: dont be too much worried.<br>
This simply means that your OSM input file does actually contains several broken cross-references (i.e. invalid complex Map objects).<br>
This one is a quite common situation, but it's rather innocuous (invalid objects will be simply ignored, fully preserving any other valid object).<br><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-map.png" alt="db-map.png" border="1"><br>
... you can explore this DB-file e.g. using <u><b>spatialite_gui</b></u> ...<br><br>
<img src="http://www.gaia-gis.it/gaia-sins/graph-pics/osm-map.png" alt="osm-map.png" border="1"><br>
... or you can connect the DB-file to a more conventional desktop GIS such as QGIS, so to immediately see your map appearing on the screen.
<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 da6eb7912af45ad2b1cb4ef976cd5731