Artifact
120a26fdaa2fa4f3e989194a50d26ec10a0d6c97:
Wiki page
[BLOB-TinyPoint] by
sandro
2018-03-21 12:08:52.
0000: 44 20 32 30 31 38 2d 30 33 2d 32 31 54 31 32 3a D 2018-03-21T12:
0010: 30 38 3a 35 32 2e 37 39 30 0a 4c 20 42 4c 4f 42 08:52.790.L BLOB
0020: 2d 54 69 6e 79 50 6f 69 6e 74 0a 50 20 61 62 31 -TinyPoint.P ab1
0030: 65 62 63 37 33 62 63 62 32 37 30 61 30 32 38 38 ebc73bcb270a0288
0040: 35 61 34 35 30 36 33 36 36 32 38 62 36 35 31 64 5a450636628b651d
0050: 63 35 37 37 34 0a 55 20 73 61 6e 64 72 6f 0a 57 c5774.U sandro.W
0060: 20 39 30 35 36 0a 3c 61 20 68 72 65 66 3d 22 68 9056.<a href="h
0070: 74 74 70 73 3a 2f 2f 77 77 77 2e 67 61 69 61 2d ttps://www.gaia-
0080: 67 69 73 2e 69 74 2f 66 6f 73 73 69 6c 2f 6c 69 gis.it/fossil/li
0090: 62 73 70 61 74 69 61 6c 69 74 65 2f 77 69 6b 69 bspatialite/wiki
00a0: 3f 6e 61 6d 65 3d 34 2e 33 2e 30 2b 64 6f 63 22 ?name=4.3.0+doc"
00b0: 3e 62 61 63 6b 3c 2f 61 3e 0d 0a 3c 68 32 3e 41 >back</a>..<h2>A
00c0: 62 6f 75 74 20 74 68 65 20 42 4c 4f 42 2d 54 69 bout the BLOB-Ti
00d0: 6e 79 50 6f 69 6e 74 20 69 6e 74 65 72 6e 61 6c nyPoint internal
00e0: 20 65 6e 63 6f 64 69 6e 67 3c 2f 68 32 3e 0d 0a encoding</h2>..
00f0: 53 74 61 72 74 69 6e 67 20 73 69 6e 63 65 20 76 Starting since v
0100: 65 72 73 69 6f 6e 20 3c 62 3e 35 2e 30 2e 30 3c ersion <b>5.0.0<
0110: 2f 62 3e 20 53 70 61 74 69 61 4c 69 74 65 20 73 /b> SpatiaLite s
0120: 75 70 70 6f 72 74 73 20 61 20 6e 65 77 20 69 6e upports a new in
0130: 74 65 72 6e 61 6c 20 42 4c 4f 42 20 65 6e 63 6f ternal BLOB enco
0140: 64 69 6e 67 20 6e 61 6d 65 64 20 3c 62 3e 42 4c ding named <b>BL
0150: 4f 42 2d 54 69 6e 79 50 6f 69 6e 74 3c 2f 62 3e OB-TinyPoint</b>
0160: 2e 3c 62 72 3e 3c 62 72 3e 0d 0a 41 6c 6c 20 70 .<br><br>..All p
0170: 72 65 76 69 6f 75 73 20 76 65 72 73 69 6f 6e 73 revious versions
0180: 20 61 6c 72 65 61 64 79 20 73 75 70 70 6f 72 74 already support
0190: 65 64 20 74 68 65 20 63 6c 61 73 73 69 63 20 3c ed the classic <
01a0: 62 3e 42 4c 4f 42 2d 47 45 4f 4d 45 54 52 59 3c b>BLOB-GEOMETRY<
01b0: 2f 62 3e 20 65 6e 63 6f 64 69 6e 67 3b 20 74 68 /b> encoding; th
01c0: 65 20 6e 65 77 20 3c 62 3e 42 4c 4f 42 2d 54 69 e new <b>BLOB-Ti
01d0: 6e 79 50 6f 69 6e 74 3c 2f 62 3e 20 69 73 20 61 nyPoint</b> is a
01e0: 6e 20 61 6c 74 65 72 6e 61 74 69 76 65 20 65 6e n alternative en
01f0: 63 6f 64 69 6e 67 20 73 70 65 63 69 66 69 63 61 coding specifica
0200: 6c 6c 79 20 69 6e 74 65 6e 64 65 64 20 66 6f 72 lly intended for
0210: 20 73 74 6f 72 69 6e 67 20 47 65 6f 6d 65 74 72 storing Geometr
0220: 69 65 73 20 6f 66 20 74 68 65 20 3c 62 3e 50 4f ies of the <b>PO
0230: 49 4e 54 3c 2f 62 3e 20 54 79 70 65 20 28 3c 69 INT</b> Type (<i
0240: 3e 50 4f 49 4e 54 3c 2f 69 3e 2c 20 3c 69 3e 50 >POINT</i>, <i>P
0250: 4f 49 4e 54 20 5a 3c 2f 69 3e 2c 20 3c 69 3e 50 OINT Z</i>, <i>P
0260: 4f 49 4e 54 20 4d 3c 2f 69 3e 20 61 6e 64 20 3c OINT M</i> and <
0270: 69 3e 50 4f 49 4e 54 20 5a 4d 3c 2f 69 3e 29 2e i>POINT ZM</i>).
0280: 3c 62 72 3e 0d 0a 42 6f 74 68 20 65 6e 63 6f 64 <br>..Both encod
0290: 69 6e 67 73 20 61 72 65 20 66 75 6e 63 74 69 6f ings are functio
02a0: 6e 61 6c 6c 79 20 65 71 75 69 76 61 6c 65 6e 74 nally equivalent
02b0: 2c 20 62 75 74 20 3c 62 3e 42 4c 4f 42 2d 54 69 , but <b>BLOB-Ti
02c0: 6e 79 50 6f 69 6e 74 3c 2f 62 3e 20 72 65 71 75 nyPoint</b> requ
02d0: 69 72 65 73 20 61 20 73 69 67 6e 69 66 69 63 61 ires a significa
02e0: 6e 74 6c 79 20 72 65 64 75 63 65 64 20 73 74 6f ntly reduced sto
02f0: 72 61 67 65 20 61 6d 6f 75 6e 74 2c 20 61 6e 64 rage amount, and
0300: 20 74 68 69 73 20 63 6f 75 6c 64 20 62 65 20 61 this could be a
0310: 20 72 61 74 68 65 72 20 63 72 69 74 69 63 61 6c rather critical
0320: 20 66 61 63 74 6f 72 20 6f 6e 20 61 6c 6c 20 70 factor on all p
0330: 6c 61 74 66 6f 72 6d 73 20 77 69 74 68 20 76 65 latforms with ve
0340: 72 79 20 6c 69 6d 69 74 65 64 20 72 65 73 6f 75 ry limited resou
0350: 72 63 65 73 2c 20 61 73 20 65 2e 67 2e 20 65 6d rces, as e.g. em
0360: 62 65 64 64 65 64 20 6f 72 20 6d 6f 62 69 6c 65 bedded or mobile
0370: 20 64 65 76 69 63 65 73 2e 3c 62 72 3e 3c 62 72 devices.<br><br
0380: 3e 0d 0a 3c 75 6c 3e 0d 0a 3c 6c 69 3e 54 68 65 >..<ul>..<li>The
0390: 20 63 6c 61 73 73 69 63 20 3c 62 3e 42 4c 4f 42 classic <b>BLOB
03a0: 2d 47 45 4f 4d 45 54 52 59 3c 2f 62 3e 20 65 6e -GEOMETRY</b> en
03b0: 63 6f 64 69 6e 67 20 61 6c 77 61 79 73 20 72 65 coding always re
03c0: 71 75 69 72 65 73 20 74 6f 20 65 78 70 6c 69 63 quires to explic
03d0: 69 74 6c 79 20 64 65 66 69 6e 65 20 74 68 65 20 itly define the
03e0: 3c 62 3e 42 42 4f 58 3c 2f 62 3e 20 6f 66 20 74 <b>BBOX</b> of t
03f0: 68 65 20 65 6e 63 6f 64 65 64 20 47 65 6f 6d 65 he encoded Geome
0400: 74 72 79 2e 3c 62 72 3e 0d 0a 34 20 64 6f 75 62 try.<br>..4 doub
0410: 6c 65 20 70 72 65 63 69 73 69 6f 6e 20 76 61 6c le precision val
0420: 75 65 73 20 61 72 65 20 72 65 71 75 69 72 65 64 ues are required
0430: 20 74 6f 20 73 74 6f 72 65 20 74 68 65 20 42 42 to store the BB
0440: 4f 58 20 28 33 32 20 62 79 74 65 73 29 2e 3c 2f OX (32 bytes).</
0450: 6c 69 3e 0d 0a 3c 6c 69 3e 42 75 74 20 69 6e 20 li>..<li>But in
0460: 74 68 65 20 76 65 72 79 20 73 70 65 63 69 66 69 the very specifi
0470: 63 20 63 61 73 65 20 6f 66 20 3c 62 3e 50 4f 49 c case of <b>POI
0480: 4e 54 3c 2f 62 3e 20 47 65 6f 6d 65 74 72 69 65 NT</b> Geometrie
0490: 73 20 74 68 69 73 20 69 73 6e 27 74 20 73 74 72 s this isn't str
04a0: 69 63 74 6c 79 20 72 65 71 75 69 72 65 64 20 6a ictly required j
04b0: 75 73 74 20 62 65 63 61 75 73 65 20 74 68 65 20 ust because the
04c0: 42 42 4f 58 20 6f 66 20 61 20 50 4f 49 4e 54 20 BBOX of a POINT
04d0: 69 73 20 74 68 65 20 50 4f 49 4e 54 20 69 74 73 is the POINT its
04e0: 65 6c 66 2e 3c 62 72 3e 0d 0a 53 6f 20 74 68 65 elf.<br>..So the
04f0: 20 6e 65 77 20 3c 62 3e 42 4c 4f 42 2d 54 69 6e new <b>BLOB-Tin
0500: 79 50 6f 69 6e 74 3c 2f 62 3e 20 65 6e 63 6f 64 yPoint</b> encod
0510: 69 6e 67 20 6c 61 63 6b 73 20 61 6e 20 65 78 70 ing lacks an exp
0520: 6c 69 63 69 74 20 42 42 4f 58 20 74 68 75 73 20 licit BBOX thus
0530: 72 65 71 75 69 72 69 6e 67 20 6c 65 73 73 20 73 requiring less s
0540: 74 6f 72 61 67 65 20 73 70 61 63 65 2c 20 61 73 torage space, as
0550: 20 73 68 6f 77 6e 20 69 6e 20 74 68 65 20 66 6f shown in the fo
0560: 6c 6c 6f 77 69 6e 67 20 74 61 62 6c 65 3a 3c 62 llowing table:<b
0570: 72 3e 3c 62 72 3e 0d 0a 3c 74 61 62 6c 65 20 62 r><br>..<table b
0580: 6f 72 64 65 72 3d 22 31 22 20 62 67 63 6f 6c 6f order="1" bgcolo
0590: 72 3d 22 23 66 66 66 66 61 30 22 20 63 65 6c 6c r="#ffffa0" cell
05a0: 73 70 61 63 69 6e 67 3d 22 36 22 20 63 65 6c 6c spacing="6" cell
05b0: 70 61 64 64 69 6e 67 3d 22 36 22 3e 0d 0a 3c 74 padding="6">..<t
05c0: 72 3e 0d 0a 3c 74 68 3e 47 65 6f 6d 65 74 72 79 r>..<th>Geometry
05d0: 20 43 6c 61 73 73 3c 2f 74 68 3e 0d 0a 3c 74 68 Class</th>..<th
05e0: 3e 42 4c 4f 42 2d 47 45 4f 4d 45 54 52 59 3c 62 >BLOB-GEOMETRY<b
05f0: 72 3e 73 69 7a 65 20 69 6e 20 62 79 74 65 73 3c r>size in bytes<
0600: 2f 74 68 3e 0d 0a 3c 74 68 3e 42 4c 4f 42 2d 54 /th>..<th>BLOB-T
0610: 69 6e 79 50 6f 69 6e 74 3c 62 72 3e 73 69 7a 65 inyPoint<br>size
0620: 20 69 6e 20 62 79 74 65 73 3c 2f 74 68 3e 0d 0a in bytes</th>..
0630: 3c 2f 74 72 3e 0d 0a 3c 74 72 3e 0d 0a 3c 74 64 </tr>..<tr>..<td
0640: 3e 50 4f 49 4e 54 3c 2f 74 64 3e 3c 74 64 20 61 >POINT</td><td a
0650: 6c 69 67 6e 3d 22 63 65 6e 74 65 72 22 3e 36 30 lign="center">60
0660: 3c 2f 74 64 3e 3c 74 64 20 61 6c 69 67 6e 3d 22 </td><td align="
0670: 63 65 6e 74 65 72 22 3e 32 34 3c 2f 74 64 3e 0d center">24</td>.
0680: 0a 3c 2f 74 72 3e 0d 0a 3c 74 72 3e 0d 0a 3c 74 .</tr>..<tr>..<t
0690: 64 3e 50 4f 49 4e 54 20 5a 3c 2f 74 64 3e 3c 74 d>POINT Z</td><t
06a0: 64 20 61 6c 69 67 6e 3d 22 63 65 6e 74 65 72 22 d align="center"
06b0: 3e 36 38 3c 2f 74 64 3e 3c 74 64 20 61 6c 69 67 >68</td><td alig
06c0: 6e 3d 22 63 65 6e 74 65 72 22 3e 33 32 3c 2f 74 n="center">32</t
06d0: 64 3e 0d 0a 3c 2f 74 72 3e 0d 0a 3c 74 72 3e 0d d>..</tr>..<tr>.
06e0: 0a 3c 74 64 3e 50 4f 49 4e 54 20 4d 3c 2f 74 64 .<td>POINT M</td
06f0: 3e 3c 74 64 20 61 6c 69 67 6e 3d 22 63 65 6e 74 ><td align="cent
0700: 65 72 22 3e 36 38 3c 2f 74 64 3e 3c 74 64 20 61 er">68</td><td a
0710: 6c 69 67 6e 3d 22 63 65 6e 74 65 72 22 3e 33 32 lign="center">32
0720: 3c 2f 74 64 3e 0d 0a 3c 2f 74 72 3e 0d 0a 3c 74 </td>..</tr>..<t
0730: 72 3e 0d 0a 3c 74 64 3e 50 4f 49 4e 54 20 5a 4d r>..<td>POINT ZM
0740: 3c 2f 74 64 3e 3c 74 64 20 61 6c 69 67 6e 3d 22 </td><td align="
0750: 63 65 6e 74 65 72 22 3e 37 36 3c 2f 74 64 3e 3c center">76</td><
0760: 74 64 20 61 6c 69 67 6e 3d 22 63 65 6e 74 65 72 td align="center
0770: 22 3e 34 30 3c 2f 74 64 3e 0d 0a 3c 2f 74 72 3e ">40</td>..</tr>
0780: 0d 0a 3c 2f 74 61 62 6c 65 3e 0d 0a 3c 2f 6c 69 ..</table>..</li
0790: 3e 0d 0a 3c 2f 75 6c 3e 3c 62 72 3e 0d 0a 3c 74 >..</ul><br>..<t
07a0: 61 62 6c 65 20 63 65 6c 6c 73 70 61 63 69 6e 67 able cellspacing
07b0: 3d 22 31 30 22 20 63 65 6c 6c 70 61 64 64 69 6e ="10" cellpaddin
07c0: 67 3d 22 31 30 22 20 62 67 63 6f 6c 6f 72 3d 22 g="10" bgcolor="
07d0: 23 61 30 66 66 61 30 22 3e 0d 0a 3c 74 72 3e 3c #a0ffa0">..<tr><
07e0: 74 64 3e 0d 0a 54 68 65 20 63 6f 6d 70 6c 65 74 td>..The complet
07f0: 65 20 61 6e 64 20 66 75 6c 6c 79 20 64 65 74 61 e and fully deta
0800: 69 6c 65 64 20 74 65 63 68 6e 69 63 61 6c 20 73 iled technical s
0810: 70 65 63 69 66 69 63 61 74 69 6f 6e 20 6f 66 20 pecification of
0820: 74 68 65 20 3c 62 3e 42 4c 4f 42 2d 54 69 6e 79 the <b>BLOB-Tiny
0830: 50 6f 69 6e 74 3c 2f 62 3e 20 65 6e 63 6f 64 69 Point</b> encodi
0840: 6e 67 20 69 73 20 70 75 62 6c 69 73 68 65 64 20 ng is published
0850: 3c 61 20 68 72 65 66 3d 22 68 74 74 70 73 3a 2f <a href="https:/
0860: 2f 77 77 77 2e 67 61 69 61 2d 67 69 73 2e 69 74 /www.gaia-gis.it
0870: 2f 67 61 69 61 2d 73 69 6e 73 2f 42 4c 4f 42 2d /gaia-sins/BLOB-
0880: 54 69 6e 79 50 6f 69 6e 74 2e 68 74 6d 6c 22 3e TinyPoint.html">
0890: 68 65 72 65 3c 2f 61 3e 0d 0a 3c 2f 74 64 3e 3c here</a>..</td><
08a0: 2f 74 72 3e 0d 0a 3c 2f 74 61 62 6c 65 3e 0d 0a /tr>..</table>..
08b0: 3c 68 32 3e 43 72 6f 73 73 20 76 65 72 73 69 6f <h2>Cross versio
08c0: 6e 20 63 6f 6d 70 61 74 69 62 69 6c 69 74 79 20 n compatibility
08d0: 69 73 73 75 65 73 3c 2f 68 32 3e 0d 0a 3c 75 6c issues</h2>..<ul
08e0: 3e 0d 0a 3c 6c 69 3e 3c 62 3e 6c 69 62 73 70 61 >..<li><b>libspa
08f0: 74 69 61 6c 69 74 65 2d 35 2e 30 2e 30 3c 2f 62 tialite-5.0.0</b
0900: 3e 20 28 6f 72 20 61 6e 79 20 73 75 62 73 65 71 > (or any subseq
0910: 75 65 6e 74 20 76 65 72 73 69 6f 6e 29 20 69 73 uent version) is
0920: 20 73 74 72 69 63 74 6c 79 20 72 65 71 75 69 72 strictly requir
0930: 65 64 20 73 6f 20 74 6f 20 63 6f 72 72 65 63 74 ed so to correct
0940: 6c 79 20 72 65 61 64 20 61 6e 64 20 77 72 69 74 ly read and writ
0950: 65 20 74 68 65 20 6e 65 77 20 3c 62 3e 42 4c 4f e the new <b>BLO
0960: 42 2d 54 69 6e 79 50 6f 69 6e 74 3c 2f 62 3e 20 B-TinyPoint</b>
0970: 65 6e 63 6f 64 69 6e 67 2e 3c 2f 6c 69 3e 0d 0a encoding.</li>..
0980: 3c 6c 69 3e 61 6c 6c 20 70 72 65 76 69 6f 75 73 <li>all previous
0990: 20 76 65 72 73 69 6f 6e 73 20 77 69 6c 6c 20 73 versions will s
09a0: 69 6d 70 6c 79 20 63 6f 6e 73 69 64 65 72 20 69 imply consider i
09b0: 74 20 61 73 20 61 20 67 65 6e 65 72 69 63 20 75 t as a generic u
09c0: 6e 71 75 61 6c 69 66 69 65 64 20 42 4c 4f 42 2c nqualified BLOB,
09d0: 20 61 6e 64 20 77 69 6c 6c 20 63 6f 6e 73 65 71 and will conseq
09e0: 75 65 6e 74 6c 79 20 66 61 69 6c 20 74 6f 20 72 uently fail to r
09f0: 65 63 6f 67 6e 69 7a 65 20 61 20 76 61 6c 69 64 ecognize a valid
0a00: 20 47 65 6f 6d 65 74 72 79 20 65 6e 63 6f 64 69 Geometry encodi
0a10: 6e 67 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 73 6f ng.</li>..<li>so
0a20: 20 79 6f 75 20 73 68 6f 75 6c 64 20 61 6c 77 61 you should alwa
0a30: 79 73 20 63 61 72 65 66 75 6c 6c 79 20 63 6f 6e ys carefully con
0a40: 73 69 64 65 72 20 77 68 65 72 65 20 74 6f 20 61 sider where to a
0a50: 64 6f 70 74 20 74 68 65 20 6e 65 77 20 3c 62 3e dopt the new <b>
0a60: 42 4c 4f 42 2d 54 69 6e 79 50 6f 69 6e 74 3c 2f BLOB-TinyPoint</
0a70: 62 3e 20 65 6e 63 6f 64 69 6e 67 2e 3c 62 72 3e b> encoding.<br>
0a80: 0d 0a 49 74 20 63 6f 75 6c 64 20 62 65 20 61 62 ..It could be ab
0a90: 73 6f 6c 75 74 65 6c 79 20 70 61 69 6e 6c 65 73 solutely painles
0aa0: 73 20 69 6e 20 74 68 65 20 63 6f 6e 74 65 78 74 s in the context
0ab0: 20 6f 66 20 73 6f 6d 65 20 73 70 65 63 69 66 69 of some specifi
0ac0: 63 20 61 70 70 6c 69 63 61 74 69 6f 6e 20 66 75 c application fu
0ad0: 6c 6c 79 20 62 61 73 65 64 20 6f 6e 20 53 70 61 lly based on Spa
0ae0: 74 69 61 4c 69 74 65 20 35 2e 78 2e 3c 62 72 3e tiaLite 5.x.<br>
0af0: 0d 0a 42 75 74 20 69 74 20 63 6f 75 6c 64 20 63 ..But it could c
0b00: 61 75 73 65 20 6d 61 6e 79 20 73 65 76 65 72 65 ause many severe
0b10: 20 74 72 6f 75 62 6c 65 73 20 69 6e 20 61 20 6d troubles in a m
0b20: 6f 72 65 20 63 6f 6d 70 6c 65 78 20 65 6e 76 69 ore complex envi
0b30: 72 6f 6e 6d 65 6e 74 20 77 68 65 72 65 20 6d 61 ronment where ma
0b40: 6e 79 20 64 69 66 66 65 72 65 6e 74 20 73 6f 66 ny different sof
0b50: 74 77 61 72 65 73 20 28 70 6f 73 73 69 62 6c 79 twares (possibly
0b60: 20 62 61 73 65 64 20 6f 6e 20 64 69 66 66 65 72 based on differ
0b70: 65 6e 74 20 76 65 72 73 69 6f 6e 73 20 6f 66 20 ent versions of
0b80: 53 70 61 74 69 61 4c 69 74 65 29 20 61 72 65 20 SpatiaLite) are
0b90: 65 78 70 65 63 74 65 64 20 74 6f 20 63 6c 6f 73 expected to clos
0ba0: 65 6c 79 20 69 6e 74 65 72 61 63 74 2e 3c 2f 6c ely interact.</l
0bb0: 69 3e 0d 0a 3c 6c 69 3e 74 68 65 20 64 65 66 61 i>..<li>the defa
0bc0: 75 6c 74 20 62 65 68 61 76 69 6f 72 20 6f 66 20 ult behavior of
0bd0: 3c 62 3e 6c 69 62 73 70 61 74 69 61 6c 69 74 65 <b>libspatialite
0be0: 2d 35 2e 30 2e 30 3c 2f 62 3e 20 69 73 20 74 6f -5.0.0</b> is to
0bf0: 20 63 6f 6e 74 69 6e 75 65 20 75 73 69 6e 67 20 continue using
0c00: 74 68 65 20 63 6c 61 73 73 69 63 20 3c 62 3e 42 the classic <b>B
0c10: 4c 4f 42 2d 47 45 4f 4d 45 54 52 59 3c 2f 62 3e LOB-GEOMETRY</b>
0c20: 20 65 6e 63 6f 64 69 6e 67 2c 20 73 6f 20 74 6f encoding, so to
0c30: 20 61 76 6f 69 64 20 61 6e 79 20 63 72 6f 73 73 avoid any cross
0c40: 20 76 65 72 73 69 6f 6e 20 69 73 73 75 65 2e 3c version issue.<
0c50: 62 72 3e 0d 0a 59 6f 75 20 61 72 65 20 61 6c 77 br>..You are alw
0c60: 61 79 73 20 65 78 70 65 63 74 65 64 20 74 6f 20 ays expected to
0c70: 65 78 70 6c 69 63 69 74 6c 79 20 72 65 71 75 65 explicitly reque
0c80: 73 74 20 53 70 61 74 69 61 4c 69 74 65 20 74 6f st SpatiaLite to
0c90: 20 75 73 65 20 74 68 65 20 6e 65 77 20 3c 62 3e use the new <b>
0ca0: 42 4c 4f 42 2d 54 69 6e 79 50 6f 69 6e 74 3c 2f BLOB-TinyPoint</
0cb0: 62 3e 20 65 6e 63 6f 64 69 6e 67 2e 3c 2f 6c 69 b> encoding.</li
0cc0: 3e 0d 0a 3c 2f 75 6c 3e 0d 0a 3c 68 32 3e 45 6e >..</ul>..<h2>En
0cd0: 61 62 6c 69 6e 67 2f 44 69 73 61 62 6c 69 6e 67 abling/Disabling
0ce0: 20 54 69 6e 79 50 6f 69 6e 74 3c 2f 68 32 3e 0d TinyPoint</h2>.
0cf0: 0a 59 6f 75 20 63 61 6e 20 73 65 6c 65 63 74 69 .You can selecti
0d00: 76 65 6c 79 20 65 6e 61 62 6c 65 20 6f 72 20 64 vely enable or d
0d10: 69 73 61 62 6c 65 20 54 69 6e 79 50 6f 69 6e 74 isable TinyPoint
0d20: 20 62 79 20 63 61 6c 6c 69 6e 67 20 74 68 65 20 by calling the
0d30: 66 6f 6c 6c 6f 77 69 6e 67 20 53 51 4c 20 66 75 following SQL fu
0d40: 6e 63 74 69 6f 6e 73 3a 0d 0a 3c 76 65 72 62 61 nctions:..<verba
0d50: 74 69 6d 3e 0d 0a 53 45 4c 45 43 54 20 45 6e 61 tim>..SELECT Ena
0d60: 62 6c 65 54 69 6e 79 50 6f 69 6e 74 28 29 3b 0d bleTinyPoint();.
0d70: 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d .---------------
0d80: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0d 0a 4e 55 4c 4c ----------..NULL
0d90: 0d 0a 0d 0a 53 45 4c 45 43 54 20 49 73 54 69 6e ....SELECT IsTin
0da0: 79 50 6f 69 6e 74 45 6e 61 62 6c 65 64 28 29 3b yPointEnabled();
0db0: 0d 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ..--------------
0dc0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0d 0a --------------..
0dd0: 31 0d 0a 0d 0a 53 45 4c 45 43 54 20 44 69 73 61 1....SELECT Disa
0de0: 62 6c 65 54 69 6e 79 50 6f 69 6e 74 28 29 3b 0d bleTinyPoint();.
0df0: 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d .---------------
0e00: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0d 0a 4e 55 4c 4c ----------..NULL
0e10: 0d 0a 0d 0a 53 45 4c 45 43 54 20 49 73 54 69 6e ....SELECT IsTin
0e20: 79 50 6f 69 6e 74 45 6e 61 62 6c 65 64 28 29 3b yPointEnabled();
0e30: 0d 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ..--------------
0e40: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0d 0a --------------..
0e50: 30 0d 0a 3c 2f 76 65 72 62 61 74 69 6d 3e 0d 0a 0..</verbatim>..
0e60: 3c 75 6c 3e 0d 0a 3c 6c 69 3e 69 6d 6d 65 64 69 <ul>..<li>immedi
0e70: 61 74 65 6c 79 20 61 66 74 65 72 20 63 61 6c 6c ately after call
0e80: 69 6e 67 20 3c 62 3e 45 6e 61 62 6c 65 54 69 6e ing <b>EnableTin
0e90: 79 50 6f 69 6e 74 28 29 3c 2f 62 3e 20 61 6c 6c yPoint()</b> all
0ea0: 20 50 4f 49 4e 54 2d 47 65 6f 6d 65 74 72 69 65 POINT-Geometrie
0eb0: 73 20 77 69 6c 6c 20 62 65 20 73 74 6f 72 65 64 s will be stored
0ec0: 20 69 6e 74 6f 20 74 68 65 20 6e 65 77 20 3c 62 into the new <b
0ed0: 3e 42 4c 4f 42 2d 54 69 6e 79 50 6f 69 6e 74 3c >BLOB-TinyPoint<
0ee0: 2f 62 3e 20 66 6f 72 6d 61 74 20 75 6e 74 69 6c /b> format until
0ef0: 20 74 68 65 20 65 6e 64 20 6f 66 20 74 68 65 20 the end of the
0f00: 63 75 72 72 65 6e 74 20 73 65 73 73 69 6f 6e 2c current session,
0f10: 20 6f 72 20 75 6e 74 69 6c 20 3c 62 3e 44 69 73 or until <b>Dis
0f20: 61 62 6c 65 54 69 6e 79 50 6f 69 6e 74 28 29 3c ableTinyPoint()<
0f30: 2f 62 3e 20 69 73 20 63 61 6c 6c 65 64 2e 3c 2f /b> is called.</
0f40: 6c 69 3e 0d 0a 3c 6c 69 3e 69 6d 6d 65 64 69 61 li>..<li>immedia
0f50: 74 65 6c 79 20 61 66 74 65 72 20 63 61 6c 6c 69 tely after calli
0f60: 6e 67 20 3c 62 3e 44 69 73 61 62 6c 65 54 69 6e ng <b>DisableTin
0f70: 79 50 6f 69 6e 74 28 29 3c 2f 62 3e 20 61 6c 6c yPoint()</b> all
0f80: 20 50 4f 49 4e 54 2d 47 65 6f 6d 65 74 72 69 65 POINT-Geometrie
0f90: 73 20 77 69 6c 6c 20 62 65 20 73 74 6f 72 65 64 s will be stored
0fa0: 20 69 6e 74 6f 20 74 68 65 20 63 6c 61 73 73 69 into the classi
0fb0: 63 20 3c 62 3e 42 4c 4f 42 2d 47 45 4f 4d 45 54 c <b>BLOB-GEOMET
0fc0: 52 59 3c 2f 62 3e 20 66 6f 72 6d 61 74 20 75 6e RY</b> format un
0fd0: 74 69 6c 20 74 68 65 20 65 6e 64 20 6f 66 20 74 til the end of t
0fe0: 68 65 20 63 75 72 72 65 6e 74 20 73 65 73 73 69 he current sessi
0ff0: 6f 6e 2c 20 6f 72 20 75 6e 74 69 6c 20 3c 62 3e on, or until <b>
1000: 45 6e 61 62 6c 65 54 69 6e 79 50 6f 69 6e 74 28 EnableTinyPoint(
1010: 29 3c 2f 62 3e 20 69 73 20 63 61 6c 6c 65 64 2e )</b> is called.
1020: 3c 62 72 3e 0d 0a 3c 75 3e 4e 6f 74 65 3c 2f 75 <br>..<u>Note</u
1030: 3e 3a 20 74 68 69 73 20 61 6c 77 61 79 73 20 69 >: this always i
1040: 73 20 74 68 65 20 64 65 66 61 75 6c 74 20 73 65 s the default se
1050: 74 74 69 6e 67 20 77 68 65 6e 20 65 73 74 61 62 tting when estab
1060: 6c 69 73 68 69 6e 67 20 61 20 6e 65 77 20 44 42 lishing a new DB
1070: 20 63 6f 6e 6e 65 63 74 69 6f 6e 2e 3c 2f 6c 69 connection.</li
1080: 3e 0d 0a 3c 6c 69 3e 79 6f 75 20 63 61 6e 20 65 >..<li>you can e
1090: 76 65 6e 74 75 61 6c 6c 79 20 63 61 6c 6c 20 3c ventually call <
10a0: 62 3e 49 73 54 69 6e 79 50 6f 69 6e 74 45 6e 61 b>IsTinyPointEna
10b0: 62 6c 65 64 28 29 3c 2f 62 3e 20 73 6f 20 74 6f bled()</b> so to
10c0: 20 63 68 65 63 6b 20 69 66 20 3c 62 3e 42 4c 4f check if <b>BLO
10d0: 42 2d 54 69 6e 79 50 6f 69 6e 74 3c 2f 62 3e 20 B-TinyPoint</b>
10e0: 69 73 20 63 75 72 72 65 6e 74 6c 79 20 65 6e 61 is currently ena
10f0: 62 6c 65 64 20 6f 72 20 64 69 73 61 62 6c 65 64 bled or disabled
1100: 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 3c 75 3e 49 .</li>..<li><u>I
1110: 6d 70 6f 72 74 61 6e 74 20 6e 6f 74 69 63 65 3c mportant notice<
1120: 2f 75 3e 3a 20 53 70 61 74 69 61 4c 69 74 65 20 /u>: SpatiaLite
1130: 35 2e 30 2e 30 20 69 73 20 61 6c 77 61 79 73 20 5.0.0 is always
1140: 61 62 6c 65 20 74 6f 20 63 6f 72 72 65 63 74 6c able to correctl
1150: 79 20 64 65 63 6f 64 65 20 61 6c 6c 20 3c 62 3e y decode all <b>
1160: 42 4c 4f 42 2d 54 69 6e 79 50 6f 69 6e 74 3c 2f BLOB-TinyPoint</
1170: 62 3e 20 47 65 6f 6d 65 74 72 69 65 73 3b 20 65 b> Geometries; e
1180: 6e 61 62 6c 69 6e 67 20 2f 20 64 69 73 61 62 6c nabling / disabl
1190: 69 6e 67 20 6f 6e 6c 79 20 61 70 70 6c 69 65 73 ing only applies
11a0: 20 77 68 65 6e 20 65 6e 63 6f 64 69 6e 67 2e 3c when encoding.<
11b0: 62 72 3e 0d 0a 69 6e 20 6f 74 68 65 72 20 77 6f br>..in other wo
11c0: 72 64 73 2c 20 79 6f 75 20 63 61 6e 20 66 72 65 rds, you can fre
11d0: 65 6c 79 20 63 68 6f 6f 73 65 20 77 68 69 63 68 ely choose which
11e0: 20 65 6e 63 6f 64 69 6e 67 20 69 73 20 74 6f 20 encoding is to
11f0: 62 65 20 61 64 6f 70 74 65 64 20 66 6f 72 20 61 be adopted for a
1200: 6c 6c 20 50 4f 49 4e 54 20 47 65 6f 6d 65 74 72 ll POINT Geometr
1210: 69 65 73 20 62 65 69 6e 67 20 63 72 65 61 74 65 ies being create
1220: 64 20 64 75 72 69 6e 67 20 74 68 65 20 63 75 72 d during the cur
1230: 72 65 6e 74 20 73 65 73 73 69 6f 6e 2e 3c 2f 6c rent session.</l
1240: 69 3e 0d 0a 3c 2f 75 6c 3e 3c 62 72 3e 0d 0a 3c i>..</ul><br>..<
1250: 74 61 62 6c 65 20 63 65 6c 6c 73 70 61 63 69 6e table cellspacin
1260: 67 3d 22 31 30 22 20 63 65 6c 6c 70 61 64 64 69 g="10" cellpaddi
1270: 6e 67 3d 22 31 30 22 20 62 67 63 6f 6c 6f 72 3d ng="10" bgcolor=
1280: 22 23 66 66 66 66 61 30 22 3e 0d 0a 3c 74 72 3e "#ffffa0">..<tr>
1290: 3c 74 64 3e 0d 0a 3c 68 34 3e 41 6c 74 65 72 6e <td>..<h4>Altern
12a0: 61 74 69 76 65 20 6d 65 63 68 61 6e 69 73 6d 20 ative mechanism
12b0: 62 61 73 65 64 20 6f 6e 20 65 78 74 65 72 6e 61 based on externa
12c0: 6c 20 76 61 72 69 61 62 6c 65 3c 2f 68 34 3e 0d l variable</h4>.
12d0: 0a 49 66 20 74 68 65 20 65 78 74 65 72 6e 61 6c .If the external
12e0: 20 76 61 72 69 61 62 6c 65 20 3c 62 3e 53 50 41 variable <b>SPA
12f0: 54 49 41 4c 49 54 45 5f 54 49 4e 59 50 4f 49 4e TIALITE_TINYPOIN
1300: 54 3d 31 3c 2f 62 3e 20 69 73 20 61 63 74 75 61 T=1</b> is actua
1310: 6c 6c 79 20 73 65 74 20 77 68 65 6e 20 65 73 74 lly set when est
1320: 61 62 6c 69 73 68 69 6e 67 20 61 20 6e 65 77 20 ablishing a new
1330: 44 42 20 63 6f 6e 6e 65 63 74 69 6f 6e 2c 20 74 DB connection, t
1340: 68 65 6e 20 74 68 65 20 3c 62 3e 42 4c 4f 42 2d hen the <b>BLOB-
1350: 54 69 6e 79 50 6f 69 6e 74 3c 2f 62 3e 20 65 6e TinyPoint</b> en
1360: 63 6f 64 69 6e 67 20 77 69 6c 6c 20 62 65 20 69 coding will be i
1370: 6d 6d 65 64 69 61 74 65 6c 79 20 65 6e 61 62 6c mmediately enabl
1380: 65 64 20 66 6f 72 20 74 68 65 20 63 75 72 72 65 ed for the curre
1390: 6e 74 20 73 65 73 73 69 6f 6e 2e 0d 0a 3c 2f 74 nt session...</t
13a0: 64 3e 3c 2f 74 72 3e 0d 0a 3c 2f 74 61 62 6c 65 d></tr>..</table
13b0: 3e 0d 0a 3c 68 33 3e 55 73 65 66 75 6c 20 53 51 >..<h3>Useful SQ
13c0: 4c 20 74 72 69 63 6b 73 20 66 6f 72 20 42 4c 4f L tricks for BLO
13d0: 42 2d 54 69 6e 79 50 6f 69 6e 74 20 68 61 6e 64 B-TinyPoint hand
13e0: 6c 69 6e 67 3c 2f 68 33 3e 0d 0a 3c 76 65 72 62 ling</h3>..<verb
13f0: 61 74 69 6d 3e 0d 0a 53 45 4c 45 43 54 20 72 6f atim>..SELECT ro
1400: 77 69 64 2c 20 49 73 47 65 6f 6d 65 74 72 79 42 wid, IsGeometryB
1410: 6c 6f 62 28 67 65 6f 6d 29 2c 20 49 73 54 69 6e lob(geom), IsTin
1420: 79 50 6f 69 6e 74 42 6c 6f 62 28 67 65 6f 6d 29 yPointBlob(geom)
1430: 0d 0a 46 52 4f 4d 20 6d 79 5f 70 6f 69 6e 74 73 ..FROM my_points
1440: 3b 0d 0a 0d 0a 53 45 4c 45 43 54 20 43 6f 75 6e ;....SELECT Coun
1450: 74 28 2a 29 0d 0a 46 52 4f 4d 20 6d 79 5f 70 6f t(*)..FROM my_po
1460: 69 6e 74 73 0d 0a 57 48 45 52 45 20 49 73 54 69 ints..WHERE IsTi
1470: 6e 79 50 6f 69 6e 74 42 6c 6f 62 28 67 65 6f 6d nyPointBlob(geom
1480: 29 20 3d 20 31 3b 0d 0a 3c 2f 76 65 72 62 61 74 ) = 1;..</verbat
1490: 69 6d 3e 0d 0a 59 6f 75 20 63 61 6e 20 63 61 6c im>..You can cal
14a0: 6c 20 3c 62 3e 49 73 47 65 6f 6d 65 74 72 79 42 l <b>IsGeometryB
14b0: 6c 6f 62 28 29 3c 2f 62 3e 20 61 6e 64 2f 6f 72 lob()</b> and/or
14c0: 20 3c 62 3e 49 73 54 69 6e 79 50 6f 69 6e 74 42 <b>IsTinyPointB
14d0: 6c 6f 62 28 29 3c 2f 62 3e 20 69 6e 20 6f 72 64 lob()</b> in ord
14e0: 65 72 20 74 6f 20 71 75 69 63 6b 6c 79 20 64 65 er to quickly de
14f0: 74 65 63 74 20 77 68 69 63 68 20 6f 6e 65 20 6f tect which one o
1500: 66 20 74 68 65 20 74 77 6f 20 61 6c 74 65 72 6e f the two altern
1510: 61 74 69 76 65 20 65 6e 63 6f 64 69 6e 67 73 20 ative encodings
1520: 69 73 20 63 75 72 72 65 6e 74 6c 79 20 61 64 6f is currently ado
1530: 70 74 65 64 20 66 6f 72 20 65 61 63 68 20 50 6f pted for each Po
1540: 69 6e 74 2d 47 65 6f 6d 65 74 72 79 20 73 74 6f int-Geometry sto
1550: 72 65 64 20 69 6e 74 6f 20 61 20 44 42 2d 66 69 red into a DB-fi
1560: 6c 65 2e 0d 0a 3c 76 65 72 62 61 74 69 6d 3e 0d le...<verbatim>.
1570: 0a 55 50 44 41 54 45 20 6d 79 5f 70 6f 69 6e 74 .UPDATE my_point
1580: 73 20 53 45 54 20 67 65 6f 6d 20 3d 20 47 65 6f s SET geom = Geo
1590: 6d 65 74 72 79 50 6f 69 6e 74 45 6e 63 6f 64 65 metryPointEncode
15a0: 28 67 65 6f 6d 29 0d 0a 57 48 45 52 45 20 49 73 (geom)..WHERE Is
15b0: 47 65 6f 6d 65 74 72 79 50 6f 69 6e 74 42 6c 6f GeometryPointBlo
15c0: 62 28 67 65 6f 6d 29 20 3c 3e 20 31 3b 0d 0a 0d b(geom) <> 1;...
15d0: 0a 55 50 44 41 54 45 20 6d 79 5f 70 6f 69 6e 74 .UPDATE my_point
15e0: 73 20 53 45 54 20 67 65 6f 6d 20 3d 20 54 69 6e s SET geom = Tin
15f0: 79 50 6f 69 6e 74 45 6e 63 6f 64 65 28 67 65 6f yPointEncode(geo
1600: 6d 29 0d 0a 57 48 45 52 45 20 49 73 54 69 6e 79 m)..WHERE IsTiny
1610: 50 6f 69 6e 74 42 6c 6f 62 28 67 65 6f 6d 29 20 PointBlob(geom)
1620: 3c 3e 20 31 3b 0d 0a 56 41 43 55 55 4d 3b 0d 0a <> 1;..VACUUM;..
1630: 3c 2f 76 65 72 62 61 74 69 6d 3e 0d 0a 59 6f 75 </verbatim>..You
1640: 20 63 61 6e 20 63 61 6c 6c 20 3c 62 3e 47 65 6f can call <b>Geo
1650: 6d 65 74 72 79 50 6f 69 6e 74 45 6e 63 6f 64 65 metryPointEncode
1660: 28 29 3c 2f 62 3e 20 6f 72 20 3c 62 3e 54 69 6e ()</b> or <b>Tin
1670: 79 50 6f 69 6e 74 45 6e 63 6f 64 65 28 29 3c 2f yPointEncode()</
1680: 62 3e 20 69 6e 20 6f 72 64 65 72 20 74 6f 20 63 b> in order to c
1690: 6f 6e 76 65 72 74 20 50 6f 69 6e 74 73 20 66 72 onvert Points fr
16a0: 6f 6d 20 61 6e 20 65 6e 63 6f 64 69 6e 67 20 74 om an encoding t
16b0: 6f 20 74 68 65 20 6f 74 68 65 72 2e 3c 62 72 3e o the other.<br>
16c0: 0d 0a 3c 75 3e 4e 6f 74 65 3c 2f 75 3e 3a 20 79 ..<u>Note</u>: y
16d0: 6f 75 20 73 68 6f 75 6c 64 20 61 6c 77 61 79 73 ou should always
16e0: 20 63 61 6c 6c 20 3c 62 3e 56 41 43 55 55 4d 3c call <b>VACUUM<
16f0: 2f 62 3e 20 61 66 74 65 72 20 65 78 65 63 75 74 /b> after execut
1700: 69 6e 67 20 3c 62 3e 54 69 6e 79 50 6f 69 6e 74 ing <b>TinyPoint
1710: 45 6e 63 6f 64 65 28 29 3c 2f 62 3e 20 69 6e 20 Encode()</b> in
1720: 6f 72 64 65 72 20 74 6f 20 65 66 66 65 63 74 69 order to effecti
1730: 76 65 6c 79 20 72 65 63 6c 61 69 6d 20 61 6e 79 vely reclaim any
1740: 20 75 6e 75 73 65 64 20 73 74 6f 72 61 67 65 20 unused storage
1750: 73 70 61 63 65 2e 0d 0a 3c 76 65 72 62 61 74 69 space...<verbati
1760: 6d 3e 0d 0a 55 50 44 41 54 45 20 6d 79 5f 70 6f m>..UPDATE my_po
1770: 69 6e 74 73 20 53 45 54 20 67 65 6f 6d 20 3d 20 ints SET geom =
1780: 47 65 6f 6d 65 74 72 79 50 6f 69 6e 74 45 6e 63 GeometryPointEnc
1790: 6f 64 65 28 67 65 6f 6d 29 0d 0a 57 48 45 52 45 ode(geom)..WHERE
17a0: 20 49 73 47 65 6f 6d 65 74 72 79 50 6f 69 6e 74 IsGeometryPoint
17b0: 42 6c 6f 62 28 67 65 6f 6d 29 20 3d 20 31 3b 0d Blob(geom) = 1;.
17c0: 0a 0d 0a 55 50 44 41 54 45 20 6d 79 5f 70 6f 69 ...UPDATE my_poi
17d0: 6e 74 73 20 53 45 54 20 67 65 6f 6d 20 3d 20 54 nts SET geom = T
17e0: 69 6e 79 50 6f 69 6e 74 45 6e 63 6f 64 65 28 67 inyPointEncode(g
17f0: 65 6f 6d 29 0d 0a 57 48 45 52 45 20 49 73 54 69 eom)..WHERE IsTi
1800: 6e 79 50 6f 69 6e 74 42 6c 6f 62 28 67 65 6f 6d nyPointBlob(geom
1810: 29 20 3d 20 31 3b 0d 0a 56 41 43 55 55 4d 3b 0d ) = 1;..VACUUM;.
1820: 0a 3c 2f 76 65 72 62 61 74 69 6d 3e 0d 0a 3c 75 .</verbatim>..<u
1830: 3e 4e 6f 74 65 3c 2f 75 3e 3a 20 63 61 6c 6c 69 >Note</u>: calli
1840: 6e 67 20 3c 62 3e 54 69 6e 79 50 6f 69 6e 74 45 ng <b>TinyPointE
1850: 6e 63 6f 64 65 28 29 3c 2f 62 3e 20 6f 6e 20 62 ncode()</b> on b
1860: 65 68 61 6c 66 20 6f 66 20 64 61 74 61 20 61 6c ehalf of data al
1870: 72 65 61 64 79 20 65 6e 63 6f 64 65 64 20 61 73 ready encoded as
1880: 20 3c 62 3e 42 4c 4f 42 2d 54 69 6e 79 50 6f 69 <b>BLOB-TinyPoi
1890: 6e 74 3c 2f 62 3e 20 69 73 20 61 6e 20 69 6e 74 nt</b> is an int
18a0: 72 69 6e 73 69 63 61 6c 6c 79 20 73 74 75 70 69 rinsically stupi
18b0: 64 20 62 75 74 20 61 62 73 6f 6c 75 74 65 6c 79 d but absolutely
18c0: 20 68 61 72 6d 6c 65 73 73 20 6f 70 65 72 61 74 harmless operat
18d0: 69 6f 6e 20 28 77 69 6c 6c 20 6a 75 73 74 20 77 ion (will just w
18e0: 61 73 74 65 20 73 65 76 65 72 61 6c 20 74 69 6d aste several tim
18f0: 65 20 77 69 74 68 20 6e 6f 20 61 70 70 61 72 65 e with no appare
1900: 6e 74 20 65 66 66 65 63 74 29 2e 3c 62 72 3e 0d nt effect).<br>.
1910: 0a 54 68 65 20 73 61 6d 65 20 61 70 70 6c 69 65 .The same applie
1920: 73 20 74 6f 20 3c 62 3e 47 65 6f 6d 65 74 72 79 s to <b>Geometry
1930: 50 6f 69 6e 74 45 6e 63 6f 64 65 28 29 3c 2f 62 PointEncode()</b
1940: 3e 20 6f 6e 20 62 65 68 61 6c 66 20 6f 66 20 3c > on behalf of <
1950: 62 3e 42 4c 4f 42 2d 47 45 4f 4d 45 54 52 59 3c b>BLOB-GEOMETRY<
1960: 2f 62 3e 20 64 61 74 61 2e 0d 0a 3c 68 31 3e 52 /b> data...<h1>R
1970: 65 61 6c 69 74 79 20 63 68 65 63 6b 3a 20 61 20 eality check: a
1980: 70 72 61 63 74 69 63 61 6c 20 74 65 73 74 3c 2f practical test</
1990: 68 31 3e 0d 0a 49 27 76 65 20 63 72 65 61 74 65 h1>..I've create
19a0: 64 20 74 77 6f 20 64 69 66 66 65 72 65 6e 74 20 d two different
19b0: 44 42 2d 66 69 6c 65 73 20 62 61 73 65 64 20 6f DB-files based o
19c0: 6e 20 74 68 65 20 73 61 6d 65 20 69 6e 70 75 74 n the same input
19d0: 20 64 61 74 61 73 65 74 2c 20 74 68 65 20 66 69 dataset, the fi
19e0: 72 73 74 20 6f 6e 65 20 66 75 6c 6c 79 20 62 61 rst one fully ba
19f0: 73 65 64 20 6f 6e 20 74 68 65 20 63 6c 61 73 73 sed on the class
1a00: 69 63 20 3c 62 3e 42 4c 4f 42 2d 47 65 6f 6d 65 ic <b>BLOB-Geome
1a10: 74 72 79 3c 2f 62 3e 20 65 6e 63 6f 64 69 6e 67 try</b> encoding
1a20: 2c 20 74 68 65 20 73 65 63 6f 6e 64 20 6f 6e 65 , the second one
1a30: 20 62 61 73 65 64 20 6f 6e 20 74 68 65 20 6e 65 based on the ne
1a40: 77 20 3c 62 3e 42 4c 4f 42 2d 54 69 6e 79 50 6f w <b>BLOB-TinyPo
1a50: 69 6e 74 3c 2f 62 3e 20 65 6e 63 6f 64 69 6e 67 int</b> encoding
1a60: 2e 3c 62 72 3e 3c 62 72 3e 0d 0a 54 68 65 20 69 .<br><br>..The i
1a70: 6e 70 75 74 20 64 61 74 61 73 65 74 20 77 61 73 nput dataset was
1a80: 20 74 68 65 20 77 65 6c 6c 20 6b 6e 6f 77 6e 20 the well known
1a90: 3c 62 3e 47 65 6f 4e 61 6d 65 73 3c 2f 62 3e 2c <b>GeoNames</b>,
1aa0: 20 61 20 77 6f 72 6c 64 77 69 64 65 20 63 6f 6c a worldwide col
1ab0: 6c 65 63 74 69 6f 6e 20 6f 66 20 61 62 6f 75 74 lection of about
1ac0: 20 31 32 20 6d 69 6c 6c 69 6f 6e 20 50 4f 49 73 12 million POIs
1ad0: 2e 3c 62 72 3e 0d 0a 47 65 6f 4e 61 6d 65 73 20 .<br>..GeoNames
1ae0: 69 6e 63 6c 75 64 65 73 20 73 65 76 65 72 61 6c includes several
1af0: 20 64 61 74 61 20 63 6f 6c 75 6d 6e 73 2c 20 62 data columns, b
1b00: 75 74 20 69 6e 20 6f 72 64 65 72 20 74 6f 20 73 ut in order to s
1b10: 69 6d 70 6c 69 66 79 20 61 73 20 6d 75 63 68 20 implify as much
1b20: 61 73 20 70 6f 73 73 69 62 6c 65 20 49 20 6a 75 as possible I ju
1b30: 73 74 20 64 65 66 69 6e 65 64 20 74 68 72 65 65 st defined three
1b40: 20 63 6f 6c 75 6d 6e 73 20 69 6e 20 6d 79 20 74 columns in my t
1b50: 65 73 74 3a 0d 0a 3c 6f 6c 3e 0d 0a 3c 6c 69 3e est:..<ol>..<li>
1b60: 3c 62 3e 69 64 3c 2f 62 3e 20 49 4e 54 45 47 45 <b>id</b> INTEGE
1b70: 52 20 50 52 49 4d 41 52 59 20 4b 45 59 3c 2f 6c R PRIMARY KEY</l
1b80: 69 3e 0d 0a 3c 6c 69 3e 3c 62 3e 6e 61 6d 65 3c i>..<li><b>name<
1b90: 2f 62 3e 20 54 45 58 54 3c 2f 6c 69 3e 0d 0a 3c /b> TEXT</li>..<
1ba0: 6c 69 3e 3c 62 3e 67 65 6f 6d 3c 2f 62 3e 20 50 li><b>geom</b> P
1bb0: 4f 49 4e 54 20 28 53 52 49 44 3d 34 33 32 36 29 OINT (SRID=4326)
1bc0: 3c 2f 6c 69 3e 0d 0a 3c 2f 6f 6c 3e 0d 0a 54 68 </li>..</ol>..Th
1bd0: 65 20 61 63 74 75 61 6c 20 66 69 6e 64 69 6e 67 e actual finding
1be0: 73 20 6f 66 20 74 68 69 73 20 74 65 73 74 20 61 s of this test a
1bf0: 72 65 20 72 65 70 6f 72 74 65 64 20 69 6e 20 74 re reported in t
1c00: 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 74 61 62 he following tab
1c10: 6c 65 3a 0d 0a 3c 74 61 62 6c 65 20 62 6f 72 64 le:..<table bord
1c20: 65 72 3d 22 31 22 20 62 67 63 6f 6c 6f 72 3d 22 er="1" bgcolor="
1c30: 23 66 66 66 66 61 30 22 20 63 65 6c 6c 73 70 61 #ffffa0" cellspa
1c40: 63 69 6e 67 3d 22 36 22 20 63 65 6c 6c 70 61 64 cing="6" cellpad
1c50: 64 69 6e 67 3d 22 36 22 3e 0d 0a 3c 74 72 3e 0d ding="6">..<tr>.
1c60: 0a 3c 74 68 20 72 6f 77 73 70 61 6e 3d 22 32 22 .<th rowspan="2"
1c70: 3e 3c 2f 74 68 3e 0d 0a 3c 74 68 20 63 6f 6c 73 ></th>..<th cols
1c80: 70 61 6e 3d 22 32 22 20 61 6c 69 67 6e 3d 22 63 pan="2" align="c
1c90: 65 6e 74 65 72 22 3e 44 42 2d 66 69 6c 65 20 73 enter">DB-file s
1ca0: 69 7a 65 3c 2f 74 68 3e 0d 0a 3c 2f 74 72 3e 0d ize</th>..</tr>.
1cb0: 0a 3c 74 72 3e 0d 0a 3c 74 68 3e 42 4c 4f 42 2d .<tr>..<th>BLOB-
1cc0: 47 45 4f 4d 45 54 52 59 3c 62 72 3e 65 6e 63 6f GEOMETRY<br>enco
1cd0: 64 65 64 3c 2f 74 68 3e 0d 0a 3c 74 68 3e 42 4c ded</th>..<th>BL
1ce0: 4f 42 2d 54 69 6e 79 50 6f 69 6e 74 3c 62 72 3e OB-TinyPoint<br>
1cf0: 65 6e 63 6f 64 65 64 3c 2f 74 68 3e 0d 0a 3c 2f encoded</th>..</
1d00: 74 72 3e 0d 0a 3c 74 72 3e 0d 0a 3c 74 64 3e 77 tr>..<tr>..<td>w
1d10: 69 74 68 6f 75 74 20 53 70 61 74 69 61 6c 20 49 ithout Spatial I
1d20: 6e 64 65 78 3c 2f 74 64 3e 3c 74 64 20 61 6c 69 ndex</td><td ali
1d30: 67 6e 3d 22 63 65 6e 74 65 72 22 3e 31 2e 31 20 gn="center">1.1
1d40: 47 42 3c 2f 74 64 3e 3c 74 64 20 61 6c 69 67 6e GB</td><td align
1d50: 3d 22 63 65 6e 74 65 72 22 3e 36 33 37 20 4d 42 ="center">637 MB
1d60: 3c 2f 74 64 3e 0d 0a 3c 2f 74 72 3e 0d 0a 3c 74 </td>..</tr>..<t
1d70: 72 3e 0d 0a 3c 74 64 3e 77 69 74 68 20 53 70 61 r>..<td>with Spa
1d80: 74 69 61 6c 20 49 6e 64 65 78 3c 2f 74 64 3e 3c tial Index</td><
1d90: 74 64 20 61 6c 69 67 6e 3d 22 63 65 6e 74 65 72 td align="center
1da0: 22 3e 31 2e 37 20 47 42 3c 2f 74 64 3e 3c 74 64 ">1.7 GB</td><td
1db0: 20 61 6c 69 67 6e 3d 22 63 65 6e 74 65 72 22 3e align="center">
1dc0: 31 2e 33 20 47 42 3c 2f 74 64 3e 0d 0a 3c 2f 74 1.3 GB</td>..</t
1dd0: 72 3e 0d 0a 3c 2f 74 61 62 6c 65 3e 0d 0a 3c 68 r>..</table>..<h
1de0: 33 3e 43 6f 6e 63 6c 75 73 69 6f 6e 73 3c 2f 68 3>Conclusions</h
1df0: 33 3e 0d 0a 3c 75 6c 3e 0d 0a 3c 6c 69 3e 54 68 3>..<ul>..<li>Th
1e00: 65 20 6e 65 77 20 42 4c 4f 42 2d 54 69 6e 79 50 e new BLOB-TinyP
1e10: 6f 69 6e 74 20 65 6e 63 6f 64 69 6e 67 20 63 61 oint encoding ca
1e20: 6e 20 65 66 66 65 63 74 69 76 65 6c 79 20 65 6e n effectively en
1e30: 73 75 72 65 20 61 6e 20 69 6d 70 72 65 73 73 69 sure an impressi
1e40: 76 65 20 73 61 76 69 6e 67 20 6f 66 20 73 74 6f ve saving of sto
1e50: 72 61 67 65 20 73 70 61 63 65 20 28 61 62 6f 75 rage space (abou
1e60: 74 20 35 30 25 20 69 6e 20 74 68 65 20 6d 65 61 t 50% in the mea
1e70: 6e 20 63 61 73 65 29 2e 3c 62 72 3e 0d 0a 3c 75 n case).<br>..<u
1e80: 3e 3c 62 3e 57 61 72 6e 69 6e 67 3c 2f 62 3e 3c ><b>Warning</b><
1e90: 2f 75 3e 3a 20 74 68 69 73 20 6f 6e 6c 79 20 61 /u>: this only a
1ea0: 70 70 6c 69 65 73 20 74 6f 20 47 65 6f 6d 65 74 pplies to Geomet
1eb0: 72 79 20 64 61 74 61 20 6f 66 20 74 68 65 20 50 ry data of the P
1ec0: 6f 69 6e 74 20 74 79 70 65 2c 20 62 75 74 20 68 oint type, but h
1ed0: 61 73 20 6e 6f 20 65 66 66 65 63 74 20 6f 6e 20 as no effect on
1ee0: 6f 74 68 65 72 20 47 65 6f 6d 65 74 72 79 20 43 other Geometry C
1ef0: 6c 61 73 73 65 73 2c 20 6f 6e 20 61 74 74 72 69 lasses, on attri
1f00: 62 75 74 65 20 64 61 74 61 20 61 6e 64 20 6f 6e bute data and on
1f10: 20 53 70 61 74 69 61 6c 20 49 6e 64 69 63 65 73 Spatial Indices
1f20: 2e 3c 62 72 3e 0d 0a 52 65 61 6c 20 77 6f 72 6c .<br>..Real worl
1f30: 64 20 44 42 2d 66 69 6c 65 73 20 75 73 75 61 6c d DB-files usual
1f40: 6c 79 20 63 6f 6e 74 61 69 6e 73 20 61 20 6d 69 ly contains a mi
1f50: 78 20 6f 66 20 50 6f 69 6e 74 2c 20 4c 69 6e 65 x of Point, Line
1f60: 73 74 72 69 6e 67 20 61 6e 64 20 50 6f 6c 79 67 string and Polyg
1f70: 6f 6e 20 47 65 6f 6d 65 74 72 69 65 73 20 61 73 on Geometries as
1f80: 73 6f 63 69 61 74 65 64 20 77 69 74 68 20 72 69 sociated with ri
1f90: 63 68 20 73 65 74 73 20 6f 66 20 61 74 74 72 69 ch sets of attri
1fa0: 62 75 74 65 73 20 61 6e 64 20 73 75 70 70 6f 72 butes and suppor
1fb0: 74 65 64 20 62 79 20 53 70 61 74 69 61 6c 20 49 ted by Spatial I
1fc0: 6e 64 69 63 65 73 2e 3c 62 72 3e 0d 0a 54 68 69 ndices.<br>..Thi
1fd0: 73 20 74 65 73 74 20 77 61 73 20 62 61 73 65 64 s test was based
1fe0: 20 6f 6e 20 61 20 72 61 74 68 65 72 20 62 6f 72 on a rather bor
1ff0: 64 65 72 6c 69 6e 65 20 73 61 6d 70 6c 65 20 28 derline sample (
2000: 61 20 73 69 6e 67 6c 65 20 68 75 67 65 20 74 61 a single huge ta
2010: 62 6c 65 20 6f 66 20 50 6f 69 6e 74 73 20 69 6e ble of Points in
2020: 63 6c 75 64 69 6e 67 20 6a 75 73 74 20 6f 6e 65 cluding just one
2030: 20 61 74 74 72 69 62 75 74 65 29 2c 20 73 6f 20 attribute), so
2040: 69 74 27 73 20 73 74 72 6f 6e 67 6c 79 20 62 69 it's strongly bi
2050: 61 73 65 64 20 74 6f 77 61 72 64 20 74 68 65 20 ased toward the
2060: 6f 70 74 69 6d 69 73 74 69 63 20 73 69 64 65 2e optimistic side.
2070: 3c 62 72 3e 0d 0a 52 65 61 6c 20 77 6f 72 6c 64 <br>..Real world
2080: 20 44 42 2d 66 69 6c 65 73 20 77 69 6c 6c 20 73 DB-files will s
2090: 75 72 65 6c 79 20 73 68 6f 77 20 6c 65 73 73 20 urely show less
20a0: 69 6d 70 72 65 73 73 69 76 65 20 73 74 6f 72 61 impressive stora
20b0: 67 65 20 73 61 76 69 6e 67 73 2c 20 70 72 65 73 ge savings, pres
20c0: 75 6d 61 62 6c 79 20 69 6e 20 74 68 65 20 72 61 umably in the ra
20d0: 6e 67 65 20 62 65 74 77 65 65 6e 20 31 30 25 20 nge between 10%
20e0: 61 6e 64 20 32 35 25 20 64 65 70 65 6e 64 69 6e and 25% dependin
20f0: 67 20 6f 6e 20 74 68 65 20 61 63 74 75 61 6c 20 g on the actual
2100: 6e 61 74 75 72 65 20 6f 66 20 74 68 65 20 64 61 nature of the da
2110: 74 61 73 65 74 73 2e 3c 2f 6c 69 3e 0d 0a 3c 6c tasets.</li>..<l
2120: 69 3e 55 73 69 6e 67 20 74 68 65 20 42 4c 4f 42 i>Using the BLOB
2130: 2d 54 69 6e 79 50 6f 69 6e 74 20 65 6e 63 6f 64 -TinyPoint encod
2140: 69 6e 67 20 63 61 6e 20 65 66 66 65 63 74 69 76 ing can effectiv
2150: 65 6c 79 20 62 65 20 61 20 76 61 6c 69 64 20 73 ely be a valid s
2160: 6f 6c 75 74 69 6f 6e 20 66 6f 72 20 61 6c 6c 20 olution for all
2170: 61 70 70 6c 69 63 61 74 69 6f 6e 73 20 64 65 73 applications des
2180: 70 65 72 61 74 65 6c 79 20 72 65 71 75 69 72 69 perately requiri
2190: 6e 67 20 74 6f 20 73 71 75 65 65 7a 65 20 74 6f ng to squeeze to
21a0: 20 6d 69 6e 69 6d 61 6c 20 74 65 72 6d 73 20 74 minimal terms t
21b0: 68 65 20 73 69 7a 65 20 6f 66 20 74 68 65 69 72 he size of their
21c0: 20 44 42 2d 66 69 6c 65 73 20 28 61 73 20 69 73 DB-files (as is
21d0: 20 74 68 65 20 74 79 70 69 63 61 6c 20 73 63 65 the typical sce
21e0: 6e 61 72 69 6f 20 66 6f 72 20 65 6d 62 65 64 64 nario for embedd
21f0: 65 64 20 6f 72 20 6d 6f 62 69 6c 65 20 64 65 76 ed or mobile dev
2200: 69 63 65 73 29 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 ices).</li>..<li
2210: 3e 54 68 65 20 67 65 6e 65 72 61 6c 69 7a 65 64 >The generalized
2220: 20 61 64 6f 70 74 69 6f 6e 20 6f 66 20 74 68 65 adoption of the
2230: 20 42 4c 4f 42 2d 54 69 6e 79 50 6f 69 6e 74 20 BLOB-TinyPoint
2240: 65 6e 63 6f 64 69 6e 67 20 73 68 6f 75 6c 64 20 encoding should
2250: 61 6c 77 61 79 73 20 62 65 20 76 65 72 79 20 63 always be very c
2260: 61 72 65 66 75 6c 6c 79 20 70 6c 61 6e 6e 65 64 arefully planned
2270: 20 6f 6e 20 6d 6f 72 65 20 63 6f 6d 70 6c 65 78 on more complex
2280: 20 65 6e 76 69 72 6f 6e 6d 65 6e 74 73 20 75 73 environments us
2290: 69 6e 67 20 6d 61 6e 79 20 64 69 66 66 65 72 65 ing many differe
22a0: 6e 74 20 73 6f 66 74 77 61 72 65 20 70 61 63 6b nt software pack
22b0: 61 67 65 73 2c 20 70 6f 73 73 69 62 6c 79 20 62 ages, possibly b
22c0: 61 73 65 64 20 6f 6e 20 64 69 66 66 65 72 65 6e ased on differen
22d0: 74 20 76 65 72 73 69 6f 6e 73 20 6f 66 20 53 70 t versions of Sp
22e0: 61 74 69 61 4c 69 74 65 2e 3c 62 72 3e 0d 0a 4e atiaLite.<br>..N
22f0: 65 76 65 72 20 66 6f 72 67 65 74 20 6f 72 20 6f ever forget or o
2300: 76 65 72 6c 6f 6f 6b 20 74 68 61 74 20 42 4c 4f verlook that BLO
2310: 42 2d 54 69 6e 79 50 6f 69 6e 74 20 77 69 6c 6c B-TinyPoint will
2320: 20 73 75 72 65 6c 79 20 70 6f 73 65 20 73 65 76 surely pose sev
2330: 65 72 65 20 63 72 6f 73 73 2d 76 65 72 73 69 6f ere cross-versio
2340: 6e 20 63 6f 6d 70 61 74 69 62 69 6c 69 74 79 20 n compatibility
2350: 69 73 73 75 65 73 2e 3c 2f 6c 69 3e 0d 0a 3c 2f issues.</li>..</
2360: 75 6c 3e 0d 0a 3c 62 72 3e 3c 68 72 3e 3c 62 72 ul>..<br><hr><br
2370: 3e 0d 0a 3c 61 20 68 72 65 66 3d 22 68 74 74 70 >..<a href="http
2380: 73 3a 2f 2f 77 77 77 2e 67 61 69 61 2d 67 69 73 s://www.gaia-gis
2390: 2e 69 74 2f 66 6f 73 73 69 6c 2f 6c 69 62 73 70 .it/fossil/libsp
23a0: 61 74 69 61 6c 69 74 65 2f 77 69 6b 69 3f 6e 61 atialite/wiki?na
23b0: 6d 65 3d 34 2e 33 2e 30 2b 64 6f 63 22 3e 62 61 me=4.3.0+doc">ba
23c0: 63 6b 3c 2f 61 3e 0a 5a 20 63 33 64 66 32 37 61 ck</a>.Z c3df27a
23d0: 32 66 37 66 31 32 38 63 39 31 31 32 64 32 39 62 2f7f128c9112d29b
23e0: 64 38 65 37 30 62 35 36 37 0a d8e70b567.