Hex Artifact Content
Not logged in

Artifact 5a9f22859036a5a493e5b5c956392959b213f0f0:

Wiki page [spatialite_osm_map] by sandro 2012-05-03 11:37:33.
0000: 44 20 32 30 31 32 2d 30 35 2d 30 33 54 31 31 3a  D 2012-05-03T11:
0010: 33 37 3a 33 33 2e 32 31 32 0a 4c 20 73 70 61 74  37:33.212.L spat
0020: 69 61 6c 69 74 65 5f 6f 73 6d 5f 6d 61 70 0a 50  ialite_osm_map.P
0030: 20 32 38 63 61 38 33 65 35 62 31 61 63 61 62 31   28ca83e5b1acab1
0040: 30 34 39 33 31 63 66 62 37 37 30 30 63 66 33 65  04931cfb7700cf3e
0050: 34 39 35 37 63 34 32 63 63 0a 55 20 73 61 6e 64  4957c42cc.U sand
0060: 72 6f 0a 57 20 33 30 34 33 0a 62 61 63 6b 20 74  ro.W 3043.back t
0070: 6f 20 74 68 65 20 3c 61 20 68 72 65 66 3d 22 68  o the <a href="h
0080: 74 74 70 73 3a 2f 2f 77 77 77 2e 67 61 69 61 2d  ttps://www.gaia-
0090: 67 69 73 2e 69 74 2f 66 6f 73 73 69 6c 2f 73 70  gis.it/fossil/sp
00a0: 61 74 69 61 6c 69 74 65 2d 74 6f 6f 6c 73 2f 77  atialite-tools/w
00b0: 69 6b 69 3f 6e 61 6d 65 3d 4f 53 4d 2b 74 6f 6f  iki?name=OSM+too
00c0: 6c 73 22 3e 4f 53 4d 20 74 6f 6f 6c 73 3c 2f 61  ls">OSM tools</a
00d0: 3e 20 6d 61 69 6e 20 70 61 67 65 3c 62 72 3e 3c  > main page<br><
00e0: 62 72 3e 0d 0a 3c 68 33 3e 73 70 61 74 69 61 6c  br>..<h3>spatial
00f0: 69 74 65 5f 6f 73 6d 5f 6d 61 70 3c 2f 68 33 3e  ite_osm_map</h3>
0100: 0d 0a 3c 62 3e 3c 69 3e 3c 75 3e 53 79 6e 74 61  ..<b><i><u>Synta
0110: 78 3a 3c 2f 75 3e 3c 2f 69 3e 3c 2f 62 3e 0d 0a  x:</u></i></b>..
0120: 3c 74 61 62 6c 65 20 62 6f 72 64 65 72 3d 22 31  <table border="1
0130: 22 3e 3c 74 72 3e 3c 74 64 3e 3c 70 72 65 3e 0d  "><tr><td><pre>.
0140: 0a 75 73 61 67 65 3a 20 73 70 61 74 69 61 6c 69  .usage: spatiali
0150: 74 65 5f 6f 73 6d 5f 6d 61 70 20 41 52 47 4c 49  te_osm_map ARGLI
0160: 53 54 0d 0a 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ST..============
0170: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
0180: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
0190: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d  ================
01a0: 3d 3d 0d 0a 2d 68 20 6f 72 20 2d 2d 68 65 6c 70  ==..-h or --help
01b0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
01c0: 20 20 20 20 70 72 69 6e 74 20 74 68 69 73 20 68      print this h
01d0: 65 6c 70 20 6d 65 73 73 61 67 65 0d 0a 2d 6f 20  elp message..-o 
01e0: 6f 72 20 2d 2d 6f 73 6d 2d 70 61 74 68 20 70 61  or --osm-path pa
01f0: 74 68 6e 61 6d 65 20 20 20 20 20 20 20 74 68 65  thname       the
0200: 20 4f 53 4d 2d 58 4d 4c 20 66 69 6c 65 20 70 61   OSM-XML file pa
0210: 74 68 0d 0a 20 20 20 20 20 20 20 20 20 20 20 20  th..            
0220: 20 20 20 20 20 62 6f 74 68 20 4f 53 4d 2d 58 4d       both OSM-XM
0230: 4c 20 28 2a 2e 6f 73 6d 29 20 61 6e 64 20 4f 53  L (*.osm) and OS
0240: 4d 2d 50 72 6f 74 6f 42 75 66 0d 0a 20 20 20 20  M-ProtoBuf..    
0250: 20 20 20 20 20 20 20 20 20 20 20 20 20 28 2a 2e               (*.
0260: 6f 73 6d 2e 70 62 66 29 20 61 72 65 20 69 6e 64  osm.pbf) are ind
0270: 69 66 66 65 72 65 6e 63 74 6c 79 20 73 75 70 70  ifferenctly supp
0280: 6f 72 74 65 64 2e 0d 0a 2d 64 20 6f 72 20 2d 2d  orted...-d or --
0290: 64 62 2d 70 61 74 68 20 20 70 61 74 68 6e 61 6d  db-path  pathnam
02a0: 65 20 20 20 20 20 20 20 74 68 65 20 53 70 61 74  e       the Spat
02b0: 69 61 4c 69 74 65 20 44 42 20 70 61 74 68 0d 0a  iaLite DB path..
02c0: 0d 0a 79 6f 75 20 63 61 6e 20 73 70 65 63 69 66  ..you can specif
02d0: 79 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20  y the following 
02e0: 6f 70 74 69 6f 6e 73 20 61 73 20 77 65 6c 6c 0d  options as well.
02f0: 0a 2d 63 73 20 6f 72 20 2d 2d 63 61 63 68 65 2d  .-cs or --cache-
0300: 73 69 7a 65 20 20 20 20 6e 75 6d 20 20 20 20 20  size    num     
0310: 20 44 42 20 63 61 63 68 65 20 73 69 7a 65 20 28   DB cache size (
0320: 68 6f 77 20 6d 61 6e 79 20 70 61 67 65 73 29 0d  how many pages).
0330: 0a 2d 6d 20 6f 72 20 2d 2d 69 6e 2d 6d 65 6d 6f  .-m or --in-memo
0340: 72 79 20 20 20 20 20 20 20 20 20 20 20 20 20 20  ry              
0350: 20 75 73 69 6e 67 20 49 4e 2d 4d 45 4d 4f 52 59   using IN-MEMORY
0360: 20 64 61 74 61 62 61 73 65 0d 0a 2d 6e 20 6f 72   database..-n or
0370: 20 2d 2d 6e 6f 2d 73 70 61 74 69 61 6c 2d 69 6e   --no-spatial-in
0380: 64 65 78 20 20 20 20 20 20 20 20 73 75 70 70 72  dex        suppr
0390: 65 73 73 20 52 2a 54 72 65 65 73 20 67 65 6e 65  ess R*Trees gene
03a0: 72 61 74 69 6f 6e 0d 0a 2d 6a 6f 20 6f 72 20 2d  ration..-jo or -
03b0: 2d 6a 6f 75 72 6e 61 6c 2d 6f 66 66 20 20 20 20  -journal-off    
03c0: 20 20 20 20 20 20 20 20 75 6e 73 61 66 65 20 28          unsafe (
03d0: 62 75 74 20 66 61 73 74 65 72 29 20 6d 6f 64 65  but faster) mode
03e0: 0d 0a 3c 2f 70 72 65 3e 3c 2f 74 64 3e 3c 2f 74  ..</pre></td></t
03f0: 72 3e 3c 2f 74 61 62 6c 65 3e 3c 62 72 3e 0d 0a  r></table><br>..
0400: 3c 62 3e 3c 69 3e 3c 75 3e 45 78 61 6d 70 6c 65  <b><i><u>Example
0410: 3a 3c 2f 75 3e 3c 2f 69 3e 3c 2f 62 3e 0d 0a 3c  :</u></i></b>..<
0420: 74 61 62 6c 65 20 62 6f 72 64 65 72 3d 22 31 22  table border="1"
0430: 3e 3c 74 72 3e 3c 74 64 3e 3c 70 72 65 3e 0d 0a  ><tr><td><pre>..
0440: 24 20 73 70 61 74 69 61 6c 69 74 65 5f 6f 73 6d  $ spatialite_osm
0450: 5f 72 61 77 20 2d 6f 20 6d 79 5f 63 6f 75 6e 74  _raw -o my_count
0460: 72 79 2e 6f 73 6d 2e 70 62 66 20 2d 64 20 6d 79  ry.osm.pbf -d my
0470: 5f 63 6f 75 6e 74 72 79 2e 73 71 6c 69 74 65 0d  _country.sqlite.
0480: 0a 53 51 4c 69 74 65 20 76 65 72 73 69 6f 6e 3a  .SQLite version:
0490: 20 33 2e 37 2e 31 31 0d 0a 53 70 61 74 69 61 4c   3.7.11..SpatiaL
04a0: 69 74 65 20 76 65 72 73 69 6f 6e 3a 20 33 2e 31  ite version: 3.1
04b0: 2e 30 0d 0a 69 6e 73 65 72 74 65 64 20 33 30 34  .0..inserted 304
04c0: 37 39 37 32 20 6e 6f 64 65 73 0d 0a 20 20 20 20  7972 nodes..    
04d0: 20 20 20 20 31 36 36 36 33 34 20 74 61 67 73 0d      166634 tags.
04e0: 0a 69 6e 73 65 72 74 65 64 20 32 33 33 34 38 31  .inserted 233481
04f0: 20 77 61 79 73 0d 0a 20 20 20 20 20 20 20 20 34   ways..        4
0500: 32 33 34 36 32 20 74 61 67 73 0d 0a 20 20 20 20  23462 tags..    
0510: 20 20 20 20 33 34 36 31 33 32 31 20 6e 6f 64 65      3461321 node
0520: 2d 72 65 66 73 0d 0a 69 6e 73 65 72 74 65 64 20  -refs..inserted 
0530: 36 30 36 38 20 72 65 6c 61 74 69 6f 6e 73 0d 0a  6068 relations..
0540: 20 20 20 20 20 20 20 20 31 34 38 31 35 20 74 61          14815 ta
0550: 67 73 0d 0a 20 20 20 20 20 20 20 20 35 36 36 31  gs..        5661
0560: 37 20 72 65 66 73 0d 0a 24 0d 0a 3c 2f 70 72 65  7 refs..$..</pre
0570: 3e 3c 2f 74 64 3e 3c 2f 74 72 3e 3c 2f 74 61 62  ></td></tr></tab
0580: 6c 65 3e 3c 62 72 3e 0d 0a 74 68 65 20 61 62 6f  le><br>..the abo
0590: 76 65 20 73 68 6f 77 6e 20 63 6f 6d 6d 61 6e 64  ve shown command
05a0: 20 6d 75 73 74 20 62 65 20 69 6e 76 6f 6b 65 64   must be invoked
05b0: 20 66 72 6f 6d 20 74 68 65 20 73 68 65 6c 6c 3a   from the shell:
05c0: 3c 75 6c 3e 0d 0a 3c 6c 69 3e 3c 62 3e 2d 6f 20  <ul>..<li><b>-o 
05d0: 6d 79 5f 63 6f 75 6e 74 72 79 2e 6f 73 6d 2e 70  my_country.osm.p
05e0: 62 66 3c 2f 62 3e 20 73 65 6c 65 63 74 73 20 74  bf</b> selects t
05f0: 68 65 20 4f 53 4d 20 69 6e 70 75 74 20 66 69 6c  he OSM input fil
0600: 65 20 28 69 6e 20 74 68 69 73 20 63 61 73 65 2c  e (in this case,
0610: 20 6f 66 20 74 68 65 20 4f 53 4d 2d 70 72 6f 74   of the OSM-prot
0620: 6f 62 75 66 20 66 6f 72 6d 61 74 29 2e 3c 2f 6c  obuf format).</l
0630: 69 3e 0d 0a 3c 6c 69 3e 3c 62 3e 2d 64 20 6d 79  i>..<li><b>-d my
0640: 5f 63 6f 75 6e 74 72 79 2e 73 71 6c 69 74 65 3c  _country.sqlite<
0650: 2f 62 3e 20 73 65 6c 65 63 74 73 20 74 68 65 20  /b> selects the 
0660: 53 70 61 74 69 61 4c 69 74 65 27 73 20 44 42 2d  SpatiaLite's DB-
0670: 66 69 6c 65 20 74 6f 20 62 65 20 63 72 65 61 74  file to be creat
0680: 65 64 20 61 6e 64 20 70 6f 70 75 6c 61 74 65 64  ed and populated
0690: 2e 3c 2f 6c 69 3e 20 0d 0a 3c 6c 69 3e 79 6f 75  .</li> ..<li>you
06a0: 20 63 61 6e 20 65 76 65 6e 74 75 61 6c 6c 79 20   can eventually 
06b0: 61 64 64 20 61 6e 79 20 6f 74 68 65 72 20 44 42  add any other DB
06c0: 2d 72 65 6c 61 74 65 64 20 6f 70 74 69 6d 69 7a  -related optimiz
06d0: 61 74 69 6f 6e 20 73 77 69 74 63 68 2c 20 69 66  ation switch, if
06e0: 20 79 6f 75 20 74 68 69 6e 6b 20 69 74 20 77 69   you think it wi
06f0: 6c 6c 20 62 65 20 75 73 65 66 75 6c 2e 3c 62 72  ll be useful.<br
0700: 3e 0d 0a 57 61 6e 74 20 74 6f 20 6c 65 61 72 6e  >..Want to learn
0710: 20 6d 6f 72 65 20 3f 20 72 65 61 64 20 74 68 65   more ? read the
0720: 20 3c 61 20 68 72 65 66 3d 22 68 74 74 70 73 3a   <a href="https:
0730: 2f 2f 77 77 77 2e 67 61 69 61 2d 67 69 73 2e 69  //www.gaia-gis.i
0740: 74 2f 66 6f 73 73 69 6c 2f 73 70 61 74 69 61 6c  t/fossil/spatial
0750: 69 74 65 2d 74 6f 6f 6c 73 2f 77 69 6b 69 3f 6e  ite-tools/wiki?n
0760: 61 6d 65 3d 64 62 2d 6f 70 74 69 6d 69 7a 61 74  ame=db-optimizat
0770: 69 6f 6e 22 3e 44 42 20 6f 70 74 69 6d 69 7a 61  ion">DB optimiza
0780: 74 69 6f 6e 3c 2f 61 3e 20 73 68 6f 72 74 20 6e  tion</a> short n
0790: 6f 74 65 0d 0a 3c 2f 6c 69 3e 0d 0a 3c 2f 75 6c  ote..</li>..</ul
07a0: 3e 3c 62 72 3e 0d 0a 4f 6e 63 65 20 74 68 65 20  ><br>..Once the 
07b0: 63 6f 6d 6d 61 6e 64 20 73 75 63 63 65 73 66 75  command succesfu
07c0: 6c 6c 79 20 63 6f 6d 70 6c 65 74 65 73 20 69 74  lly completes it
07d0: 73 20 65 78 65 63 75 74 69 6f 6e 2c 20 79 6f 75  s execution, you
07e0: 27 6c 6c 20 66 69 6e 64 20 61 20 62 72 61 6e 64  'll find a brand
07f0: 20 6e 65 77 20 44 42 2d 66 69 6c 65 20 6a 75 73   new DB-file jus
0800: 74 20 63 72 65 61 74 65 64 20 2e 2e 2e 3c 62 72  t created ...<br
0810: 3e 3c 62 72 3e 0d 0a 3c 69 6d 67 20 73 72 63 3d  ><br>..<img src=
0820: 22 68 74 74 70 3a 2f 2f 77 77 77 2e 67 61 69 61  "http://www.gaia
0830: 2d 67 69 73 2e 69 74 2f 67 61 69 61 2d 73 69 6e  -gis.it/gaia-sin
0840: 73 2f 67 72 61 70 68 2d 70 69 63 73 2f 64 62 2d  s/graph-pics/db-
0850: 72 61 77 2e 70 6e 67 22 20 61 6c 74 3d 22 64 62  raw.png" alt="db
0860: 2d 72 61 77 2e 70 6e 67 22 20 62 6f 72 64 65 72  -raw.png" border
0870: 3d 22 31 22 3e 3c 62 72 3e 0d 0a 2e 2e 2e 20 79  ="1"><br>..... y
0880: 6f 75 20 63 61 6e 20 65 78 70 6c 6f 72 65 20 74  ou can explore t
0890: 68 69 73 20 44 42 2d 66 69 6c 65 20 65 2e 67 2e  his DB-file e.g.
08a0: 20 75 73 69 6e 67 20 3c 75 3e 3c 62 3e 73 70 61   using <u><b>spa
08b0: 74 69 61 6c 69 74 65 5f 67 75 69 3c 2f 62 3e 3c  tialite_gui</b><
08c0: 2f 75 3e 20 61 6e 64 20 65 78 65 63 75 74 69 6e  /u> and executin
08d0: 67 20 61 6e 79 20 53 51 4c 20 71 75 65 72 79 20  g any SQL query 
08e0: 61 74 20 79 6f 75 72 20 77 69 6c 6c 2e 3c 62 72  at your will.<br
08f0: 3e 0d 0a 65 2e 67 2e 20 69 6e 20 74 68 69 73 20  >..e.g. in this 
0900: 63 61 73 65 20 77 65 20 61 72 65 20 65 78 74 72  case we are extr
0910: 61 63 74 69 6e 67 20 61 6c 6c 20 4e 6f 64 65 73  acting all Nodes
0920: 20 65 78 70 6f 73 69 6e 67 20 74 68 65 20 3c 62   exposing the <b
0930: 3e 3c 69 3e 74 6f 75 72 69 73 6d 3a 68 6f 74 65  ><i>tourism:hote
0940: 6c 3c 2f 69 3e 3c 2f 62 3e 20 74 61 67 2c 20 61  l</i></b> tag, a
0950: 6e 64 20 62 65 69 6e 67 20 69 6e 73 65 72 74 65  nd being inserte
0960: 64 20 73 69 6e 63 65 20 41 70 72 69 6c 20 32 30  d since April 20
0970: 31 32 2e 3c 62 72 3e 3c 62 72 3e 0d 0a 3c 69 6d  12.<br><br>..<im
0980: 67 20 73 72 63 3d 22 68 74 74 70 3a 2f 2f 77 77  g src="http://ww
0990: 77 2e 67 61 69 61 2d 67 69 73 2e 69 74 2f 67 61  w.gaia-gis.it/ga
09a0: 69 61 2d 73 69 6e 73 2f 67 72 61 70 68 2d 70 69  ia-sins/graph-pi
09b0: 63 73 2f 64 62 2d 72 61 77 32 2e 70 6e 67 22 20  cs/db-raw2.png" 
09c0: 61 6c 74 3d 22 64 62 2d 72 61 77 32 2e 70 6e 67  alt="db-raw2.png
09d0: 22 20 62 6f 72 64 65 72 3d 22 31 22 3e 3c 62 72  " border="1"><br
09e0: 3e 0d 0a 74 68 69 73 20 66 75 72 74 68 65 72 20  >..this further 
09f0: 71 75 65 72 79 20 77 69 6c 6c 20 65 78 74 72 61  query will extra
0a00: 63 74 20 61 6c 6c 20 57 61 79 73 2c 20 64 65 74  ct all Ways, det
0a10: 65 72 6d 69 6e 69 6e 67 20 74 68 65 69 72 20 63  ermining their c
0a20: 6f 6d 70 6c 65 78 69 74 79 20 28 69 2e 65 2e 20  omplexity (i.e. 
0a30: 74 68 65 20 6e 75 6d 62 65 72 20 6f 66 20 72 65  the number of re
0a40: 66 65 72 65 6e 63 65 64 20 4e 6f 64 65 73 29 20  ferenced Nodes) 
0a50: 61 6e 64 20 6f 72 64 65 72 69 6e 67 20 74 68 65  and ordering the
0a60: 20 72 65 73 75 6c 74 73 65 74 20 73 6f 20 74 6f   resultset so to
0a70: 20 73 68 6f 77 20 74 68 65 20 6d 6f 73 74 20 63   show the most c
0a80: 6f 6d 70 6c 65 78 20 57 61 79 73 20 66 69 72 73  omplex Ways firs
0a90: 74 2e 3c 62 72 3e 3c 62 72 3e 0d 0a 3c 69 6d 67  t.<br><br>..<img
0aa0: 20 73 72 63 3d 22 68 74 74 70 3a 2f 2f 77 77 77   src="http://www
0ab0: 2e 67 61 69 61 2d 67 69 73 2e 69 74 2f 67 61 69  .gaia-gis.it/gai
0ac0: 61 2d 73 69 6e 73 2f 67 72 61 70 68 2d 70 69 63  a-sins/graph-pic
0ad0: 73 2f 64 62 2d 72 61 77 33 2e 70 6e 67 22 20 61  s/db-raw3.png" a
0ae0: 6c 74 3d 22 64 62 2d 72 61 77 33 2e 70 6e 67 22  lt="db-raw3.png"
0af0: 20 62 6f 72 64 65 72 3d 22 31 22 3e 3c 62 72 3e   border="1"><br>
0b00: 0d 0a 74 68 69 73 20 6c 61 73 74 20 65 78 61 6d  ..this last exam
0b10: 70 6c 65 20 71 75 65 72 79 20 77 69 6c 6c 20 65  ple query will e
0b20: 78 74 72 61 63 74 20 61 6c 6c 20 57 61 79 73 2c  xtract all Ways,
0b30: 20 63 68 65 63 6b 69 6e 67 20 66 6f 72 20 62 72   checking for br
0b40: 6f 6b 65 6e 20 4e 6f 64 65 20 72 65 66 65 72 65  oken Node refere
0b50: 6e 63 65 73 2e 3c 62 72 3e 0d 0a 69 2e 65 2e 20  nces.<br>..i.e. 
0b60: 69 74 20 77 69 6c 6c 20 63 68 65 63 6b 20 69 66  it will check if
0b70: 20 73 6f 6d 65 20 75 6e 64 65 66 69 6e 65 64 20   some undefined 
0b80: 4e 6f 64 65 20 69 73 20 72 65 66 65 72 65 6e 63  Node is referenc
0b90: 65 64 20 61 6e 79 77 61 79 2c 20 74 68 75 73 20  ed anyway, thus 
0ba0: 69 64 65 6e 74 69 66 79 69 6e 67 20 74 68 65 20  identifying the 
0bb0: 63 6f 72 72 65 73 70 6f 6e 64 69 6e 67 20 69 6e  corresponding in
0bc0: 76 61 6c 69 64 20 57 61 79 2e 3c 62 72 3e 3c 62  valid Way.<br><b
0bd0: 72 3e 0d 0a 3c 62 72 3e 3c 62 72 3e 62 61 63 6b  r>..<br><br>back
0be0: 20 74 6f 20 74 68 65 20 3c 61 20 68 72 65 66 3d   to the <a href=
0bf0: 22 68 74 74 70 73 3a 2f 2f 77 77 77 2e 67 61 69  "https://www.gai
0c00: 61 2d 67 69 73 2e 69 74 2f 66 6f 73 73 69 6c 2f  a-gis.it/fossil/
0c10: 73 70 61 74 69 61 6c 69 74 65 2d 74 6f 6f 6c 73  spatialite-tools
0c20: 2f 77 69 6b 69 3f 6e 61 6d 65 3d 4f 53 4d 2b 74  /wiki?name=OSM+t
0c30: 6f 6f 6c 73 22 3e 4f 53 4d 20 74 6f 6f 6c 73 3c  ools">OSM tools<
0c40: 2f 61 3e 20 6d 61 69 6e 20 70 61 67 65 0a 5a 20  /a> main page.Z 
0c50: 31 66 33 33 36 63 64 62 64 66 30 38 30 30 31 32  1f336cdbdf080012
0c60: 35 39 65 38 33 64 36 64 34 31 66 39 64 38 32 33  59e83d6d41f9d823
0c70: 0a                                               .