Wiki page
[Supporting GeoJSON] by
sandro
2019-01-22 12:25:55.
0000: 44 20 32 30 31 39 2d 30 31 2d 32 32 54 31 32 3a D 2019-01-22T12:
0010: 32 35 3a 35 35 2e 39 38 38 0a 4c 20 53 75 70 70 25:55.988.L Supp
0020: 6f 72 74 69 6e 67 5c 73 47 65 6f 4a 53 4f 4e 0a orting\sGeoJSON.
0030: 50 20 38 38 30 31 66 39 64 61 38 32 35 63 62 37 P 8801f9da825cb7
0040: 34 35 35 38 64 36 31 35 30 38 39 36 65 32 35 39 4558d6150896e259
0050: 65 32 64 38 66 63 32 62 35 62 0a 55 20 73 61 6e e2d8fc2b5b.U san
0060: 64 72 6f 0a 57 20 32 31 36 37 35 0a 3c 61 20 68 dro.W 21675.<a h
0070: 72 65 66 3d 22 68 74 74 70 73 3a 2f 2f 77 77 77 ref="https://www
0080: 2e 67 61 69 61 2d 67 69 73 2e 69 74 2f 66 6f 73 .gaia-gis.it/fos
0090: 73 69 6c 2f 6c 69 62 73 70 61 74 69 61 6c 69 74 sil/libspatialit
00a0: 65 2f 77 69 6b 69 3f 6e 61 6d 65 3d 34 2e 33 2e e/wiki?name=4.3.
00b0: 30 2d 64 6f 63 22 3e 62 61 63 6b 3c 2f 61 3e 3c 0-doc">back</a><
00c0: 68 72 3e 3c 62 72 3e 0d 0a 3c 68 31 3e 49 6e 74 hr><br>..<h1>Int
00d0: 72 6f 64 75 63 74 69 6f 6e 3c 2f 68 31 3e 0d 0a roduction</h1>..
00e0: 3c 61 20 68 72 65 66 3d 22 68 74 74 70 73 3a 2f <a href="https:/
00f0: 2f 65 6e 2e 77 69 6b 69 70 65 64 69 61 2e 6f 72 /en.wikipedia.or
0100: 67 2f 77 69 6b 69 2f 47 65 6f 4a 53 4f 4e 22 3e g/wiki/GeoJSON">
0110: 47 65 6f 4a 53 4f 4e 3c 2f 61 3e 20 69 73 20 61 GeoJSON</a> is a
0120: 6e 20 6f 70 65 6e 20 73 74 61 6e 64 61 72 64 20 n open standard
0130: 64 61 74 61 20 66 6f 72 6d 61 74 20 62 61 73 65 data format base
0140: 64 20 6f 6e 20 3c 61 20 68 72 65 66 3d 22 68 74 d on <a href="ht
0150: 74 70 73 3a 2f 2f 65 6e 2e 77 69 6b 69 70 65 64 tps://en.wikiped
0160: 69 61 2e 6f 72 67 2f 77 69 6b 69 2f 4a 53 4f 4e ia.org/wiki/JSON
0170: 22 3e 4a 53 4f 4e 3c 2f 61 3e 20 28 3c 62 3e 4a ">JSON</a> (<b>J
0180: 61 76 61 53 63 72 69 70 74 20 4f 62 6a 65 63 74 avaScript Object
0190: 20 4e 6f 74 61 74 69 6f 6e 3c 2f 62 3e 29 20 74 Notation</b>) t
01a0: 68 61 74 20 69 73 20 61 20 76 65 72 79 20 70 6f hat is a very po
01b0: 70 75 6c 61 72 20 64 61 74 61 20 66 6f 72 6d 61 pular data forma
01c0: 74 20 77 69 64 65 6c 79 20 75 73 65 64 20 62 79 t widely used by
01d0: 20 6d 61 6e 79 20 77 65 62 2d 61 70 70 73 20 61 many web-apps a
01e0: 73 20 61 20 72 65 70 6c 61 63 65 6d 65 6e 74 20 s a replacement
01f0: 66 6f 72 20 58 4d 4c 2e 3c 62 72 3e 0d 0a 54 68 for XML.<br>..Th
0200: 65 20 69 6e 64 65 6e 64 65 64 20 75 73 65 20 6f e indended use o
0210: 66 20 47 65 6f 4a 53 4f 4e 20 69 73 20 74 68 65 f GeoJSON is the
0220: 20 65 78 74 65 6e 73 69 6f 6e 20 6f 66 20 74 68 extension of th
0230: 65 20 62 61 73 69 63 20 63 61 70 61 62 69 6c 69 e basic capabili
0240: 74 69 65 73 20 6f 66 20 4a 53 4f 4e 20 73 6f 20 ties of JSON so
0250: 74 6f 20 61 64 65 71 75 61 74 65 6c 79 20 73 75 to adequately su
0260: 70 70 6f 72 74 20 3c 62 3e 67 65 6f 67 72 61 70 pport <b>geograp
0270: 68 69 63 20 66 65 61 74 75 72 65 73 3c 2f 62 3e hic features</b>
0280: 20 69 6e 63 6c 75 64 69 6e 67 20 62 6f 74 68 20 including both
0290: 3c 62 3e 47 65 6f 6d 65 74 72 69 65 73 3c 2f 62 <b>Geometries</b
02a0: 3e 20 61 6e 64 0d 0a 3c 62 3e 6e 6f 6e 2d 73 70 > and..<b>non-sp
02b0: 61 74 69 61 6c 20 61 74 74 72 69 62 75 74 65 73 atial attributes
02c0: 3c 2f 62 3e 2e 3c 62 72 3e 3c 62 72 3e 0d 0a 47 </b>.<br><br>..G
02d0: 65 6f 4a 53 4f 4e 2c 20 77 68 69 63 68 20 68 61 eoJSON, which ha
02e0: 73 20 65 78 69 73 74 65 64 20 66 6f 72 20 6d 61 s existed for ma
02f0: 6e 79 20 79 65 61 72 73 2c 20 77 61 73 20 69 6e ny years, was in
0300: 69 74 69 61 6c 6c 79 20 62 61 73 65 64 20 6f 6e itially based on
0310: 20 61 20 6c 6f 6f 73 65 20 61 6e 64 20 69 6e 66 a loose and inf
0320: 6f 72 6d 61 6c 20 64 61 74 61 20 73 70 65 63 69 ormal data speci
0330: 66 69 63 61 74 69 6f 6e 2e 3c 62 72 3e 0d 0a 4f fication.<br>..O
0340: 6e 6c 79 20 76 65 72 79 20 72 65 63 65 6e 74 6c nly very recentl
0350: 79 20 28 32 30 31 36 29 20 69 74 20 68 61 73 20 y (2016) it has
0360: 66 69 6e 61 6c 6c 79 20 62 65 63 6f 6d 65 20 61 finally become a
0370: 20 72 65 73 70 65 63 74 61 62 6c 65 20 73 74 61 respectable sta
0380: 6e 64 61 72 64 20 66 6f 72 6d 61 74 20 62 61 73 ndard format bas
0390: 65 64 20 6f 6e 20 61 20 66 6f 72 6d 61 6c 20 73 ed on a formal s
03a0: 70 65 63 69 66 69 63 61 74 69 6f 6e 2c 20 3c 61 pecification, <a
03b0: 20 68 72 65 66 3d 22 68 74 74 70 73 3a 2f 2f 74 href="https://t
03c0: 6f 6f 6c 73 2e 69 65 74 66 2e 6f 72 67 2f 68 74 ools.ietf.org/ht
03d0: 6d 6c 2f 72 66 63 37 39 34 36 22 3e 52 46 43 20 ml/rfc7946">RFC
03e0: 37 39 34 36 3c 2f 61 3e 2c 20 72 65 6c 65 61 73 7946</a>, releas
03f0: 65 64 20 62 79 20 3c 62 3e 49 45 54 46 3c 2f 62 ed by <b>IETF</b
0400: 3e 20 28 3c 69 3e 49 6e 74 65 72 6e 65 74 20 45 > (<i>Internet E
0410: 6e 67 69 6e 65 65 72 69 6e 67 20 54 61 73 6b 20 ngineering Task
0420: 46 6f 72 63 65 3c 2f 69 3e 29 2e 3c 62 72 3e 0d Force</i>).<br>.
0430: 0a 3c 75 3e 4e 6f 74 65 3c 2f 75 3e 3a 20 52 46 .<u>Note</u>: RF
0440: 43 20 37 39 34 36 20 69 6e 74 72 6f 64 75 63 65 C 7946 introduce
0450: 64 20 73 65 76 65 72 61 6c 20 72 65 6c 65 76 61 d several releva
0460: 6e 74 20 72 65 71 75 69 72 65 6d 65 6e 74 73 20 nt requirements
0470: 61 6e 64 20 72 65 73 74 72 69 63 74 69 6f 6e 73 and restrictions
0480: 2c 20 73 6f 20 74 68 61 74 20 3c 62 3e 70 72 65 , so that <b>pre
0490: 2d 52 46 43 3c 2f 62 3e 20 61 6e 64 20 3c 62 3e -RFC</b> and <b>
04a0: 70 6f 73 74 2d 52 46 43 3c 2f 62 3e 20 47 65 6f post-RFC</b> Geo
04b0: 4a 53 4f 4e 20 66 69 6c 65 73 20 61 72 65 20 6e JSON files are n
04c0: 6f 74 20 6d 75 74 75 61 6c 6c 79 20 69 6e 74 65 ot mutually inte
04d0: 72 6f 70 65 72 61 62 6c 65 2e 3c 62 72 3e 3c 62 roperable.<br><b
04e0: 72 3e 0d 0a 41 20 76 65 72 79 20 72 65 6d 61 72 r>..A very remar
04f0: 6b 61 62 6c 65 20 66 65 61 74 75 72 65 20 6f 66 kable feature of
0500: 20 52 46 43 20 37 39 34 36 20 69 73 20 74 68 61 RFC 7946 is tha
0510: 74 20 69 74 27 73 20 65 78 70 6c 69 63 69 74 6c t it's explicitl
0520: 79 20 64 65 63 6c 61 72 65 64 20 74 6f 20 62 65 y declared to be
0530: 20 61 20 3c 62 3e 66 69 78 65 64 20 61 6e 64 20 a <b>fixed and
0540: 69 6d 6d 75 74 61 62 6c 65 3c 2f 62 3e 20 73 70 immutable</b> sp
0550: 65 63 69 66 69 63 61 74 69 6f 6e 2e 3c 62 72 3e ecification.<br>
0560: 0d 0a 54 68 65 72 65 20 77 69 6c 6c 20 6e 65 76 ..There will nev
0570: 65 72 20 62 65 20 75 70 64 61 74 65 64 20 76 65 er be updated ve
0580: 72 73 69 6f 6e 73 20 6f 66 20 47 65 6f 4a 53 4f rsions of GeoJSO
0590: 4e 3b 20 65 76 65 6e 20 74 68 65 20 73 6c 69 67 N; even the slig
05a0: 68 74 65 73 74 20 63 68 61 6e 67 65 20 77 69 6c htest change wil
05b0: 6c 20 72 65 71 75 69 72 65 20 61 20 72 65 6e 6e l require a renn
05c0: 61 6d 65 20 66 72 6f 6d 20 47 65 6f 4a 53 4f 4e ame from GeoJSON
05d0: 20 74 6f 20 73 6f 6d 65 74 68 69 6e 67 20 65 6c to something el
05e0: 73 65 2e 3c 62 72 3e 0d 0a 53 75 63 68 20 61 20 se.<br>..Such a
05f0: 72 65 73 74 72 69 6e 63 74 69 6f 6e 20 69 73 20 restrinction is
0600: 6f 62 76 69 6f 73 6c 79 20 69 6e 74 65 6e 64 65 obviosly intende
0610: 64 20 74 6f 20 65 6e 73 75 72 65 20 61 20 76 65 d to ensure a ve
0620: 72 79 20 73 74 72 6f 6e 67 20 73 74 61 62 69 6c ry strong stabil
0630: 69 74 79 20 64 75 72 69 6e 67 20 69 74 73 20 6c ity during its l
0640: 69 66 65 74 69 6d 65 20 28 61 6e 64 20 72 65 70 ifetime (and rep
0650: 72 65 73 65 6e 74 73 20 61 20 73 74 72 6f 6e 67 resents a strong
0660: 20 72 65 61 63 74 69 6f 6e 20 74 6f 20 74 68 65 reaction to the
0670: 20 6d 61 6e 79 20 47 4d 4c 20 76 65 72 73 69 6f many GML versio
0680: 6e 73 20 74 68 61 74 20 61 62 72 75 70 74 6c 79 ns that abruptly
0690: 20 69 6e 74 72 6f 64 75 63 65 64 20 72 61 64 69 introduced radi
06a0: 63 61 6c 20 63 68 61 6e 67 65 73 20 75 70 73 65 cal changes upse
06b0: 74 74 69 6e 67 20 74 68 65 20 77 65 6c 6c 20 65 tting the well e
06c0: 73 74 61 62 6c 69 73 68 65 64 20 62 65 68 61 76 stablished behav
06d0: 69 6f 72 20 6f 66 20 65 78 69 73 74 69 6e 67 20 ior of existing
06e0: 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 73 29 implementations)
06f0: 2e 3c 62 72 3e 3c 62 72 3e 0d 0a 54 68 65 20 6d .<br><br>..The m
0700: 6f 73 74 20 6f 62 76 69 6f 75 73 20 63 6f 6d 70 ost obvious comp
0710: 65 74 69 74 6f 72 73 20 6f 66 20 47 65 6f 4a 53 etitors of GeoJS
0720: 4f 4e 20 61 72 65 20 74 68 65 20 3c 61 20 68 72 ON are the <a hr
0730: 65 66 3d 22 68 74 74 70 73 3a 2f 2f 65 6e 2e 77 ef="https://en.w
0740: 69 6b 69 70 65 64 69 61 2e 6f 72 67 2f 77 69 6b ikipedia.org/wik
0750: 69 2f 53 68 61 70 65 66 69 6c 65 22 3e 45 53 52 i/Shapefile">ESR
0760: 49 20 53 68 61 70 65 66 69 6c 65 3c 2f 61 3e 20 I Shapefile</a>
0770: 61 6e 64 20 3c 61 20 68 72 65 66 3d 22 0d 0a 68 and <a href="..h
0780: 74 74 70 73 3a 2f 2f 65 6e 2e 77 69 6b 69 70 65 ttps://en.wikipe
0790: 64 69 61 2e 6f 72 67 2f 77 69 6b 69 2f 47 65 6f dia.org/wiki/Geo
07a0: 67 72 61 70 68 79 5f 4d 61 72 6b 75 70 5f 4c 61 graphy_Markup_La
07b0: 6e 67 75 61 67 65 22 3e 47 4d 4c 3c 2f 61 3e 3c nguage">GML</a><
07c0: 62 72 3e 0d 0a 54 68 65 20 66 6f 6c 6c 6f 77 69 br>..The followi
07d0: 6e 67 20 63 68 61 72 74 20 77 69 6c 6c 20 71 75 ng chart will qu
07e0: 69 63 6b 6c 79 20 6c 69 73 74 20 74 68 65 20 6d ickly list the m
07f0: 61 69 6e 20 64 69 66 66 65 72 65 6e 63 65 73 20 ain differences
0800: 62 65 74 77 65 65 6e 20 74 68 65 6d 2e 3c 62 72 between them.<br
0810: 3e 3c 62 72 3e 0d 0a 3c 74 61 62 6c 65 20 63 65 ><br>..<table ce
0820: 6c 6c 73 70 61 63 69 6e 67 3d 22 34 22 20 63 65 llspacing="4" ce
0830: 6c 6c 70 61 64 64 69 6e 67 3d 22 38 22 20 62 67 llpadding="8" bg
0840: 63 6f 6c 6f 72 3d 22 23 63 30 65 65 63 30 22 20 color="#c0eec0"
0850: 62 6f 72 64 65 72 3d 22 31 22 3e 0d 0a 3c 74 72 border="1">..<tr
0860: 3e 3c 74 68 3e 54 6f 70 69 63 3c 2f 74 68 3e 3c ><th>Topic</th><
0870: 74 68 3e 53 68 61 70 65 66 69 6c 65 3c 2f 74 68 th>Shapefile</th
0880: 3e 3c 74 68 3e 47 4d 4c 3c 2f 74 68 3e 3c 74 68 ><th>GML</th><th
0890: 3e 47 65 6f 4a 53 4f 4e 3c 2f 74 68 3e 3c 74 68 >GeoJSON</th><th
08a0: 3e 52 65 6d 61 72 6b 73 3c 2f 74 68 3e 3c 2f 74 >Remarks</th></t
08b0: 72 3e 0d 0a 3c 74 72 3e 0d 0a 3c 74 68 20 76 61 r>..<tr>..<th va
08c0: 6c 69 67 6e 3d 22 6d 69 64 64 6c 65 22 3e 46 69 lign="middle">Fi
08d0: 6c 65 20 6f 72 67 61 6e 69 7a 61 74 69 6f 6e 3c le organization<
08e0: 2f 74 68 3e 0d 0a 3c 74 64 20 76 61 6c 69 67 6e /th>..<td valign
08f0: 3d 22 6d 69 64 64 6c 65 22 3e 41 74 20 6c 65 61 ="middle">At lea
0900: 73 74 20 74 68 72 65 65 20 69 6e 64 65 70 65 6e st three indepen
0910: 64 65 6e 74 20 66 69 6c 65 73 20 73 68 61 72 69 dent files shari
0920: 6e 67 20 74 68 65 20 73 61 6d 65 20 6e 61 6d 65 ng the same name
0930: 20 61 6e 64 20 72 65 73 70 65 63 74 69 76 65 6c and respectivel
0940: 79 20 69 64 65 6e 74 69 66 69 65 64 20 62 79 20 y identified by
0950: 73 75 66 66 69 78 65 73 20 3c 62 3e 2e 73 68 70 suffixes <b>.shp
0960: 3c 2f 62 3e 2c 20 3c 62 3e 2e 73 68 78 3c 2f 62 </b>, <b>.shx</b
0970: 3e 20 61 6e 64 20 3c 62 3e 2e 64 62 66 3c 2f 62 > and <b>.dbf</b
0980: 3e 0d 0a 3c 75 6c 3e 0d 0a 3c 6c 69 3e 42 6f 74 >..<ul>..<li>Bot
0990: 68 20 74 68 65 20 3c 62 3e 2e 73 68 70 3c 2f 62 h the <b>.shp</b
09a0: 3e 20 61 6e 64 20 3c 62 3e 2e 73 68 78 3c 2f 62 > and <b>.shx</b
09b0: 3e 20 6d 65 6d 62 65 72 73 20 61 72 65 20 3c 62 > members are <b
09c0: 3e 62 69 6e 61 72 79 20 66 69 6c 65 73 3c 2f 62 >binary files</b
09d0: 3e 20 69 6e 74 65 6e 64 65 64 20 74 6f 20 73 74 > intended to st
09e0: 6f 72 65 20 47 65 6f 6d 65 74 72 69 65 73 20 61 ore Geometries a
09f0: 6e 64 20 73 68 6f 75 6c 64 20 62 65 20 65 6e 63 nd should be enc
0a00: 6f 64 65 64 20 61 63 63 6f 72 64 69 6e 67 6c 79 oded accordingly
0a10: 20 74 6f 20 74 68 65 20 3c 61 20 68 72 65 66 3d to the <a href=
0a20: 22 68 74 74 70 73 3a 2f 2f 77 77 77 2e 65 73 72 "https://www.esr
0a30: 69 2e 63 6f 6d 2f 6c 69 62 72 61 72 79 2f 77 68 i.com/library/wh
0a40: 69 74 65 70 61 70 65 72 73 2f 70 64 66 73 2f 73 itepapers/pdfs/s
0a50: 68 61 70 65 66 69 6c 65 2e 70 64 66 22 3e 45 53 hapefile.pdf">ES
0a60: 52 49 20 6f 70 65 6e 20 73 70 65 63 69 66 69 63 RI open specific
0a70: 61 74 69 6f 6e 3c 2f 61 3e 3c 2f 6c 69 3e 0d 0a ation</a></li>..
0a80: 3c 6c 69 3e 54 68 65 20 3c 62 3e 2e 64 62 66 3c <li>The <b>.dbf<
0a90: 2f 62 3e 20 6d 65 6d 62 65 72 20 69 73 20 69 6e /b> member is in
0aa0: 74 65 6e 64 65 64 20 74 6f 20 73 74 6f 72 65 20 tended to store
0ab0: 6e 6f 6e 2d 73 70 61 74 69 61 6c 20 61 74 74 72 non-spatial attr
0ac0: 69 62 75 74 65 73 2e 3c 62 72 3e 0d 0a 54 68 69 ibutes.<br>..Thi
0ad0: 73 20 3c 62 3e 62 69 6e 61 72 79 20 66 69 6c 65 s <b>binary file
0ae0: 3c 2f 62 3e 20 69 73 20 61 6c 73 6f 20 65 78 70 </b> is also exp
0af0: 65 63 74 65 64 20 74 6f 20 62 65 20 65 6e 63 6f ected to be enco
0b00: 64 65 64 20 61 63 63 6f 72 64 69 6e 67 6c 79 20 ded accordingly
0b10: 74 6f 20 3c 61 20 68 72 65 66 3d 22 68 74 74 70 to <a href="http
0b20: 73 3a 2f 2f 65 6e 2e 77 69 6b 69 70 65 64 69 61 s://en.wikipedia
0b30: 2e 6f 72 67 2f 77 69 6b 69 2f 44 42 61 73 65 22 .org/wiki/DBase"
0b40: 3e 41 73 68 74 6f 6e 2d 54 61 74 65 20 64 42 61 >Ashton-Tate dBa
0b50: 73 65 20 73 70 65 63 69 66 69 63 61 74 69 6f 6e se specification
0b60: 3c 2f 61 3e 3b 20 75 6e 68 61 70 70 69 6c 79 20 </a>; unhappily
0b70: 74 68 69 73 20 76 65 72 79 20 6f 6c 64 20 73 70 this very old sp
0b80: 65 63 69 66 69 63 61 74 69 6f 6e 20 28 62 6f 72 ecification (bor
0b90: 6e 20 69 6e 20 74 68 65 20 27 38 30 73 29 20 68 n in the '80s) h
0ba0: 61 64 20 61 20 73 61 76 61 67 65 20 70 72 6f 6c ad a savage prol
0bb0: 69 66 65 72 61 74 69 6f 6e 20 6f 66 20 64 69 66 iferation of dif
0bc0: 66 65 72 65 6e 74 20 64 69 61 6c 65 63 74 73 20 ferent dialects
0bd0: 28 3c 69 3e 43 6c 69 70 70 65 72 3c 2f 69 3e 2c (<i>Clipper</i>,
0be0: 20 3c 69 3e 46 6f 78 50 72 6f 3c 2f 69 3e 29 20 <i>FoxPro</i>)
0bf0: 62 65 63 6f 6d 69 6e 67 20 71 75 69 74 65 20 6d becoming quite m
0c00: 65 73 73 79 20 61 6e 64 20 63 68 61 6f 74 69 63 essy and chaotic
0c10: 2e 3c 2f 6c 69 3e 0d 0a 3c 2f 75 6c 3e 0d 0a 3c .</li>..</ul>..<
0c20: 2f 74 64 3e 0d 0a 3c 74 64 3e 47 4d 4c 20 69 73 /td>..<td>GML is
0c30: 20 62 61 73 65 64 20 6f 6e 20 58 4d 4c 2c 20 61 based on XML, a
0c40: 6e 64 20 69 73 20 6a 75 73 74 20 61 20 73 69 6e nd is just a sin
0c50: 67 6c 65 2c 20 6d 6f 6e 6f 6c 69 74 68 69 63 20 gle, monolithic
0c60: 3c 62 3e 74 65 78 74 20 66 69 6c 65 2e 3c 2f 62 <b>text file.</b
0c70: 3e 3c 62 72 3e 0d 0a 41 73 20 61 6e 79 20 6f 74 ><br>..As any ot
0c80: 68 65 72 20 58 4d 4c 20 66 69 6c 65 2c 20 47 4d her XML file, GM
0c90: 4c 20 74 6f 6f 20 63 61 6e 20 62 65 20 73 74 72 L too can be str
0ca0: 6f 6e 67 6c 79 20 63 6f 6e 73 74 72 61 69 6e 65 ongly constraine
0cb0: 64 20 74 6f 20 63 6f 6e 66 6f 72 6d 20 74 6f 20 d to conform to
0cc0: 61 20 66 6f 72 6d 61 6c 6c 79 20 64 65 66 69 6e a formally defin
0cd0: 65 64 20 3c 61 20 68 72 65 66 3d 22 68 74 74 70 ed <a href="http
0ce0: 73 3a 2f 2f 69 74 2e 77 69 6b 69 70 65 64 69 61 s://it.wikipedia
0cf0: 2e 6f 72 67 2f 77 69 6b 69 2f 58 4d 4c 5f 53 63 .org/wiki/XML_Sc
0d00: 68 65 6d 61 22 3e 58 4d 4c 20 53 63 68 65 6d 61 hema">XML Schema
0d10: 3c 2f 61 3e 0d 0a 3c 2f 74 64 3e 0d 0a 3c 74 64 </a>..</td>..<td
0d20: 20 76 61 6c 69 67 6e 3d 22 6d 69 64 64 6c 65 22 valign="middle"
0d30: 3e 0d 0a 53 69 6e 67 6c 65 20 6d 6f 6e 6f 6c 69 >..Single monoli
0d40: 74 68 69 63 20 3c 62 3e 74 65 78 74 20 66 69 6c thic <b>text fil
0d50: 65 3c 2f 62 3e 2e 3c 62 72 3e 0d 0a 53 69 6d 69 e</b>.<br>..Simi
0d60: 6c 61 72 20 74 6f 20 58 4d 4c 2c 20 62 75 74 20 lar to XML, but
0d70: 69 6e 74 65 6e 64 65 64 20 74 6f 20 62 65 20 66 intended to be f
0d80: 61 72 20 73 69 6d 70 6c 65 72 20 61 6e 64 20 6c ar simpler and l
0d90: 65 73 73 20 76 65 72 62 6f 73 65 2e 0d 0a 3c 2f ess verbose...</
0da0: 74 64 3e 0d 0a 3c 74 64 3e 0d 0a 54 68 65 20 74 td>..<td>..The t
0db0: 68 72 65 65 2d 66 69 6c 65 73 20 6c 61 79 6f 75 hree-files layou
0dc0: 74 20 6f 66 20 53 68 61 70 65 66 69 6c 65 20 69 t of Shapefile i
0dd0: 73 20 63 6c 65 61 72 6c 79 20 6f 62 73 6f 6c 65 s clearly obsole
0de0: 74 65 2c 20 61 6e 64 20 69 74 20 66 72 65 71 75 te, and it frequ
0df0: 65 6e 74 6c 79 20 70 6f 73 65 73 20 6d 61 6e 79 ently poses many
0e00: 20 68 65 61 64 61 63 68 65 73 20 63 61 75 73 69 headaches causi
0e10: 6e 67 20 75 6e 65 78 70 65 63 74 65 64 20 74 72 ng unexpected tr
0e20: 6f 75 62 6c 65 73 2e 3c 62 72 3e 3c 62 72 3e 0d oubles.<br><br>.
0e30: 0a 54 68 65 20 73 69 6e 67 6c 65 2d 66 69 6c 65 .The single-file
0e40: 20 6c 61 79 6f 75 74 20 61 64 6f 70 74 65 64 20 layout adopted
0e50: 62 79 20 62 6f 74 68 20 47 4d 4c 20 61 6e 64 20 by both GML and
0e60: 47 65 6f 4a 53 4f 4e 20 69 73 20 63 6c 65 61 72 GeoJSON is clear
0e70: 6c 79 20 62 65 74 74 65 72 20 61 6e 64 20 73 61 ly better and sa
0e80: 66 65 72 2c 20 61 6e 64 20 62 65 69 6e 67 20 3c fer, and being <
0e90: 62 3e 74 65 78 74 20 66 69 6c 65 73 3c 2f 62 3e b>text files</b>
0ea0: 20 74 68 65 79 20 63 61 6e 20 62 65 20 65 61 73 they can be eas
0eb0: 69 6c 79 20 69 6e 73 70 65 63 74 65 64 20 61 6e ily inspected an
0ec0: 64 20 65 76 65 6e 74 75 61 6c 6c 79 20 64 65 62 d eventually deb
0ed0: 75 67 67 65 64 20 6a 75 73 74 20 75 73 69 6e 67 ugged just using
0ee0: 20 61 6e 79 20 67 65 6e 65 72 69 63 20 3c 62 3e any generic <b>
0ef0: 74 65 78 74 20 65 64 69 74 6f 72 3c 2f 62 3e 20 text editor</b>
0f00: 77 69 74 68 6f 75 74 20 72 65 71 75 69 72 69 6e without requirin
0f10: 67 20 61 6e 79 20 73 70 65 63 69 66 69 63 20 74 g any specific t
0f20: 6f 6f 6c 2e 0d 0a 3c 2f 74 64 3e 0d 0a 3c 2f 74 ool...</td>..</t
0f30: 72 3e 0d 0a 3c 74 72 3e 0d 0a 3c 74 68 3e 47 65 r>..<tr>..<th>Ge
0f40: 6f 6d 65 74 72 79 20 63 6c 61 73 73 65 73 3c 2f ometry classes</
0f50: 74 68 3e 0d 0a 3c 74 64 3e 0d 0a 3c 75 6c 3e 0d th>..<td>..<ul>.
0f60: 0a 3c 6c 69 3e 4e 75 6c 6c 20 53 68 61 70 65 3c .<li>Null Shape<
0f70: 2f 6c 69 3e 0d 0a 3c 6c 69 3e 50 6f 69 6e 74 3c /li>..<li>Point<
0f80: 2f 6c 69 3e 0d 0a 3c 6c 69 3e 4d 75 6c 74 69 50 /li>..<li>MultiP
0f90: 6f 69 6e 74 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 50 oint</li>..<li>P
0fa0: 6f 6c 79 4c 69 6e 65 20 28 77 69 74 68 6f 75 74 olyLine (without
0fb0: 20 64 69 73 74 69 6e 67 75 69 73 68 69 6e 67 20 distinguishing
0fc0: 62 65 74 77 65 65 6e 20 73 69 6e 67 6c 65 2d 20 between single-
0fd0: 61 6e 64 20 6d 75 6c 74 69 2d 70 61 72 74 29 3c and multi-part)<
0fe0: 2f 6c 69 3e 0d 0a 3c 6c 69 3e 50 6f 6c 79 67 6f /li>..<li>Polygo
0ff0: 6e 20 28 77 69 74 68 6f 75 74 20 64 69 73 74 69 n (without disti
1000: 6e 67 75 69 73 68 69 6e 67 20 62 65 74 77 65 65 nguishing betwee
1010: 6e 20 73 69 6e 67 6c 65 2d 20 61 6e 64 20 6d 75 n single- and mu
1020: 6c 74 69 2d 70 61 72 74 29 3c 2f 6c 69 3e 0d 0a lti-part)</li>..
1030: 3c 2f 75 6c 3e 0d 0a 3c 62 72 3e 0d 0a 3c 75 3e </ul>..<br>..<u>
1040: 4e 6f 74 65 73 3c 2f 75 3e 3a 20 0d 0a 3c 75 6c Notes</u>: ..<ul
1050: 3e 0d 0a 3c 6c 69 3e 41 6c 6c 20 47 65 6f 6d 65 >..<li>All Geome
1060: 74 72 69 65 73 20 69 6e 20 74 68 65 20 73 61 6d tries in the sam
1070: 65 20 53 68 61 70 65 66 69 6c 65 20 6d 75 73 74 e Shapefile must
1080: 20 73 68 61 72 65 20 74 68 65 20 73 61 6d 65 20 share the same
1090: 63 6c 61 73 73 20 28 6f 72 20 62 65 20 3c 62 3e class (or be <b>
10a0: 4e 75 6c 6c 3c 2f 62 3e 29 2e 3c 2f 6c 69 3e 0d Null</b>).</li>.
10b0: 0a 3c 6c 69 3e 41 6c 6c 20 47 65 6f 6d 65 74 72 .<li>All Geometr
10c0: 69 65 73 20 69 6e 20 74 68 65 20 73 61 6d 65 20 ies in the same
10d0: 53 68 61 70 65 66 69 6c 65 20 6d 75 73 74 20 73 Shapefile must s
10e0: 68 61 72 65 20 74 68 65 20 73 61 6d 65 20 53 52 hare the same SR
10f0: 49 44 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 54 68 ID.</li>..<li>Th
1100: 65 20 72 75 6c 65 73 20 66 6f 72 20 69 64 65 6e e rules for iden
1110: 74 69 66 79 69 6e 67 20 3c 62 3e 45 78 74 65 72 tifying <b>Exter
1120: 69 6f 72 3c 2f 62 3e 20 61 6e 64 20 3c 62 3e 49 ior</b> and <b>I
1130: 6e 74 65 72 69 6f 72 3c 2f 62 3e 20 50 6f 6c 79 nterior</b> Poly
1140: 67 6f 6e 20 72 69 6e 67 73 0d 0a 61 72 65 20 61 gon rings..are a
1150: 77 6b 77 61 72 64 20 61 6e 64 20 63 61 6e 20 66 wkward and can f
1160: 72 65 71 75 65 6e 74 6c 79 20 63 61 75 73 65 20 requently cause
1170: 69 6e 74 65 72 6f 70 65 72 61 62 69 6c 69 74 79 interoperability
1180: 20 69 73 73 75 65 73 2e 3c 2f 6c 69 3e 0d 0a 3c issues.</li>..<
1190: 2f 75 6c 3e 0d 0a 3c 2f 74 64 3e 0d 0a 3c 74 64 /ul>..</td>..<td
11a0: 3e 0d 0a 47 4d 4c 20 61 6c 6c 6f 77 73 20 6d 61 >..GML allows ma
11b0: 6e 79 20 64 69 66 66 65 72 65 6e 74 20 77 61 79 ny different way
11c0: 73 20 74 6f 20 64 65 66 69 6e 65 20 74 68 65 20 s to define the
11d0: 73 61 6d 65 20 74 79 70 65 20 6f 66 20 47 65 6f same type of Geo
11e0: 6d 65 74 72 79 2c 20 61 6e 64 20 74 68 65 20 73 metry, and the s
11f0: 70 65 63 69 66 69 63 61 74 69 6f 6e 73 20 68 61 pecifications ha
1200: 76 65 20 72 61 64 69 63 61 6c 6c 79 20 63 68 61 ve radically cha
1210: 6e 67 65 64 20 66 72 6f 6d 20 76 65 72 73 69 6f nged from versio
1220: 6e 20 74 6f 20 76 65 72 73 69 6f 6e 2e 3c 62 72 n to version.<br
1230: 3e 3c 62 72 3e 0d 0a 47 4d 4c 20 68 61 73 20 61 ><br>..GML has a
1240: 20 72 65 61 6c 6c 79 20 69 6d 70 72 65 73 73 69 really impressi
1250: 76 65 20 66 6c 65 78 69 62 69 6c 79 20 28 65 2e ve flexibily (e.
1260: 67 2e 20 65 61 63 68 20 73 69 6e 67 6c 65 20 47 g. each single G
1270: 65 6f 6d 65 74 72 79 20 63 61 6e 20 66 72 65 65 eometry can free
1280: 6c 79 20 64 65 63 6c 61 72 65 20 69 74 73 20 6f ly declare its o
1290: 77 6e 20 53 52 49 44 29 2c 20 62 75 74 20 61 74 wn SRID), but at
12a0: 20 74 68 65 20 63 6f 73 74 20 6f 66 20 69 6d 70 the cost of imp
12b0: 6f 73 69 6e 67 20 61 6e 20 6f 76 65 72 77 68 65 osing an overwhe
12c0: 6c 6d 69 6e 67 20 63 6f 6d 70 6c 65 78 69 74 79 lming complexity
12d0: 2e 0d 0a 3c 2f 74 64 3e 0d 0a 3c 74 64 3e 0d 0a ...</td>..<td>..
12e0: 3c 75 6c 3e 0d 0a 3c 6c 69 3e 4e 75 6c 6c 3c 2f <ul>..<li>Null</
12f0: 6c 69 3e 0d 0a 3c 6c 69 3e 50 6f 69 6e 74 3c 2f li>..<li>Point</
1300: 6c 69 3e 0d 0a 3c 6c 69 3e 4c 69 6e 65 73 74 72 li>..<li>Linestr
1310: 69 6e 67 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 50 6f ing</li>..<li>Po
1320: 6c 79 67 6f 6e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e lygon</li>..<li>
1330: 4d 75 6c 74 69 50 6f 69 6e 74 3c 2f 6c 69 3e 0d MultiPoint</li>.
1340: 0a 3c 6c 69 3e 4d 75 6c 74 69 4c 69 6e 65 73 74 .<li>MultiLinest
1350: 72 69 6e 67 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 4d ring</li>..<li>M
1360: 75 6c 74 69 50 6f 6c 79 67 6f 6e 3c 2f 6c 69 3e ultiPolygon</li>
1370: 0d 0a 3c 6c 69 3e 47 65 6f 6d 65 74 72 79 43 6f ..<li>GeometryCo
1380: 6c 6c 65 63 74 69 6f 6e 3c 2f 6c 69 3e 0d 0a 3c llection</li>..<
1390: 2f 75 6c 3e 0d 0a 3c 62 72 3e 0d 0a 3c 75 3e 4e /ul>..<br>..<u>N
13a0: 6f 74 65 73 3c 2f 75 3e 3a 20 0d 0a 3c 75 6c 3e otes</u>: ..<ul>
13b0: 0d 0a 3c 6c 69 3e 54 68 69 73 20 65 78 61 63 74 ..<li>This exact
13c0: 6c 79 20 63 6f 72 72 65 73 70 6f 6e 64 73 20 74 ly corresponds t
13d0: 6f 20 74 68 65 20 73 74 61 6e 64 61 72 64 20 3c o the standard <
13e0: 62 3e 37 20 63 6c 61 73 73 65 73 3c 2f 62 3e 20 b>7 classes</b>
13f0: 6d 6f 64 65 6c 20 61 64 6f 70 74 65 64 20 62 79 model adopted by
1400: 20 53 70 61 74 69 61 6c 20 53 51 4c 2e 3c 2f 6c Spatial SQL.</l
1410: 69 3e 0d 0a 3c 6c 69 3e 54 68 65 20 73 61 6d 65 i>..<li>The same
1420: 20 47 65 6f 4a 53 4f 4e 20 66 69 6c 65 20 63 61 GeoJSON file ca
1430: 6e 20 66 72 65 65 6c 79 20 63 6f 6e 74 61 69 6e n freely contain
1440: 20 61 6e 79 20 6b 69 6e 64 20 6f 66 20 47 65 6f any kind of Geo
1450: 6d 65 74 72 79 20 63 6c 61 73 73 65 73 20 77 69 metry classes wi
1460: 74 68 6f 75 72 20 72 65 73 74 72 69 63 74 69 6f thour restrictio
1470: 6e 73 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 41 6c ns.</li>..<li>Al
1480: 6c 20 47 65 6f 6d 65 74 72 69 65 73 20 69 6e 20 l Geometries in
1490: 74 68 65 20 73 61 6d 65 20 47 65 6f 4a 53 4f 4e the same GeoJSON
14a0: 20 66 69 6c 65 20 6d 75 73 74 20 73 68 61 72 65 file must share
14b0: 20 74 68 65 20 73 61 6d 65 20 53 52 49 44 2e 3c the same SRID.<
14c0: 2f 6c 69 3e 0d 0a 3c 2f 75 6c 3e 0d 0a 3c 2f 74 /li>..</ul>..</t
14d0: 64 3e 0d 0a 3c 74 64 3e 0d 0a 3c 75 6c 3e 0d 0a d>..<td>..<ul>..
14e0: 3c 6c 69 3e 53 68 61 70 65 66 69 6c 65 20 69 73 <li>Shapefile is
14f0: 20 6f 62 76 69 6f 75 73 6c 79 20 6f 62 73 6f 6c obviously obsol
1500: 65 74 65 2c 20 61 6e 64 20 73 6f 6d 65 77 61 79 ete, and someway
1510: 20 6d 65 73 73 79 20 61 6e 64 20 6c 69 6d 69 74 messy and limit
1520: 65 64 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 47 4d ed.</li>..<li>GM
1530: 4c 20 69 73 20 65 6c 65 67 61 6e 74 20 61 6e 64 L is elegant and
1540: 20 76 65 72 79 20 73 6f 70 68 69 73 74 69 63 61 very sophistica
1550: 74 65 64 3a 20 73 6f 6d 65 74 69 6d 65 73 20 74 ted: sometimes t
1560: 6f 6f 20 73 6f 70 68 69 73 74 69 63 61 74 65 64 oo sophisticated
1570: 20 61 6e 64 20 63 6f 6d 70 6c 65 78 20 74 6f 20 and complex to
1580: 62 65 20 72 65 61 6c 6c 79 20 75 73 61 62 6c 65 be really usable
1590: 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 47 65 6f 4a .</li>..<li>GeoJ
15a0: 53 4f 4e 20 6d 61 74 63 68 65 73 20 74 68 65 20 SON matches the
15b0: 53 70 61 74 69 61 6c 20 53 51 4c 20 72 65 71 75 Spatial SQL requ
15c0: 69 72 65 6d 65 6e 74 73 2c 20 61 6e 64 20 74 68 irements, and th
15d0: 65 72 66 6f 72 65 20 61 76 6f 69 64 73 20 61 6e erfore avoids an
15e0: 79 20 75 6e 6e 65 63 65 73 73 61 72 79 20 63 6f y unnecessary co
15f0: 6d 70 6c 65 78 69 74 79 2e 3c 2f 6c 69 3e 0d 0a mplexity.</li>..
1600: 3c 2f 75 6c 3e 0d 0a 3c 2f 74 64 3e 0d 0a 3c 2f </ul>..</td>..</
1610: 74 72 3e 0d 0a 3c 74 72 3e 0d 0a 3c 74 68 3e 44 tr>..<tr>..<th>D
1620: 69 6d 65 6e 73 69 6f 6e 73 3c 2f 74 68 3e 0d 0a imensions</th>..
1630: 3c 74 64 3e 0d 0a 3c 75 6c 3e 0d 0a 3c 6c 69 3e <td>..<ul>..<li>
1640: 58 59 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 58 59 4d XY</li>..<li>XYM
1650: 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 58 59 5a 3c 2f </li>..<li>XYZ</
1660: 6c 69 3e 0d 0a 3c 6c 69 3e 58 59 5a 4d 3c 2f 6c li>..<li>XYZM</l
1670: 69 3e 0d 0a 3c 2f 75 6c 3e 0d 0a 3c 2f 74 64 3e i>..</ul>..</td>
1680: 0d 0a 3c 74 64 3e 0d 0a 3c 75 6c 3e 0d 0a 3c 6c ..<td>..<ul>..<l
1690: 69 3e 58 59 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 58 i>XY</li>..<li>X
16a0: 59 4d 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 58 59 5a YM</li>..<li>XYZ
16b0: 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 58 59 5a 4d 3c </li>..<li>XYZM<
16c0: 2f 6c 69 3e 0d 0a 3c 2f 75 6c 3e 0d 0a 3c 2f 74 /li>..</ul>..</t
16d0: 64 3e 0d 0a 3c 74 64 3e 0d 0a 3c 75 6c 3e 0d 0a d>..<td>..<ul>..
16e0: 3c 6c 69 3e 58 59 3c 2f 6c 69 3e 0d 0a 3c 6c 69 <li>XY</li>..<li
16f0: 3e 58 59 5a 3c 2f 6c 69 3e 0d 0a 3c 2f 75 6c 3e >XYZ</li>..</ul>
1700: 0d 0a 3c 62 72 3e 0d 0a 3c 75 3e 4e 6f 74 65 3c ..<br>..<u>Note<
1710: 2f 75 3e 3a 20 52 46 43 20 37 39 34 36 20 6a 75 /u>: RFC 7946 ju
1720: 73 74 20 73 75 70 70 6f 72 74 73 20 32 20 6f 72 st supports 2 or
1730: 20 33 20 63 6f 6f 72 64 69 6e 61 74 65 73 2c 20 3 coordinates,
1740: 61 6e 64 20 74 68 65 20 74 68 69 72 64 20 76 61 and the third va
1750: 6c 75 65 20 28 77 68 65 6e 20 64 65 63 6c 61 72 lue (when declar
1760: 65 64 29 20 69 73 20 61 6c 77 61 79 73 20 65 78 ed) is always ex
1770: 70 65 63 74 65 64 20 74 6f 20 63 6f 72 72 65 73 pected to corres
1780: 70 6f 6e 64 20 74 6f 20 61 6e 20 45 6c 65 76 61 pond to an Eleva
1790: 74 69 6f 6e 20 28 5a 20 61 78 69 73 29 2e 3c 62 tion (Z axis).<b
17a0: 72 3e 3c 62 72 3e 0d 0a 53 75 70 70 6f 72 74 69 r><br>..Supporti
17b0: 6e 67 20 58 59 4d 20 6f 72 20 58 59 5a 4d 20 69 ng XYM or XYZM i
17c0: 73 20 6e 6f 74 20 74 65 63 68 6e 69 63 61 6c 6c s not technicall
17d0: 79 20 75 6e 66 65 61 73 69 62 6c 65 2e 0d 0a 42 y unfeasible...B
17e0: 6f 74 68 20 77 72 69 74 65 72 73 20 61 6e 64 20 oth writers and
17f0: 72 65 61 64 65 72 73 20 63 6f 75 6c 64 20 73 75 readers could su
1800: 70 70 6f 72 74 20 73 75 63 68 20 6f 70 74 69 6f pport such optio
1810: 6e 73 2c 20 62 75 74 20 61 6c 6c 20 74 68 69 73 ns, but all this
1820: 20 69 73 20 73 75 72 65 6c 79 20 6f 75 74 73 69 is surely outsi
1830: 64 65 20 74 68 65 20 73 74 61 6e 64 61 72 64 20 de the standard
1840: 61 6e 64 20 77 69 6c 6c 20 73 75 72 65 6c 79 20 and will surely
1850: 69 6d 70 61 69 72 20 74 68 65 20 75 6e 69 76 65 impair the unive
1860: 72 73 61 6c 20 70 6f 72 74 61 62 69 6c 69 74 79 rsal portability
1870: 20 6f 66 20 61 6e 79 20 6e 6f 6e 20 63 61 6e 6f of any non cano
1880: 6e 69 63 61 6c 20 66 69 6c 65 2e 0d 0a 3c 2f 74 nical file...</t
1890: 64 3e 0d 0a 3c 74 64 3e 0d 0a 47 65 6f 4a 53 4f d>..<td>..GeoJSO
18a0: 4e 20 6c 61 63 6b 73 20 74 68 65 20 63 61 70 61 N lacks the capa
18b0: 62 69 6c 69 74 79 20 74 6f 20 73 75 70 70 6f 72 bility to suppor
18c0: 74 20 58 59 4d 20 61 6e 64 20 58 59 5a 4d 2c 20 t XYM and XYZM,
18d0: 6f 74 68 65 72 20 74 68 61 6e 20 62 79 20 61 64 other than by ad
18e0: 6f 70 74 69 6e 67 20 28 61 6e 64 20 74 6f 20 6f opting (and to o
18f0: 74 68 65 72 73 20 75 6e 6b 6e 6f 77 6e 29 20 76 thers unknown) v
1900: 69 63 69 6f 75 73 20 74 72 69 63 6b 73 2e 3c 62 icious tricks.<b
1910: 72 3e 0d 0a 4d 61 79 20 77 65 6c 6c 20 62 65 20 r>..May well be
1920: 69 74 27 73 20 6e 6f 74 20 61 20 66 6f 72 62 69 it's not a forbi
1930: 64 64 69 6e 67 20 6c 69 6d 69 74 61 74 69 6f 6e dding limitation
1940: 20 69 6e 20 6d 61 6e 79 20 63 6f 6d 6d 6f 6e 20 in many common
1950: 63 61 73 65 73 2c 20 62 75 74 20 69 74 27 73 20 cases, but it's
1960: 69 6e 64 69 73 70 75 74 61 62 6c 79 20 61 20 6c indisputably a l
1970: 69 6d 69 74 61 74 69 6f 6e 2e 0d 0a 3c 2f 74 64 imitation...</td
1980: 3e 0d 0a 3c 2f 74 72 3e 0d 0a 3c 74 72 3e 0d 0a >..</tr>..<tr>..
1990: 3c 74 68 3e 53 52 49 44 3c 2f 74 68 3e 0d 0a 3c <th>SRID</th>..<
19a0: 74 64 3e 0d 0a 4e 6f 74 20 69 6e 74 65 72 6e 61 td>..Not interna
19b0: 6c 6c 79 20 64 65 63 6c 61 72 65 64 20 62 79 20 lly declared by
19c0: 74 68 65 20 53 68 61 70 65 66 69 6c 65 20 69 74 the Shapefile it
19d0: 73 65 6c 66 2e 3c 62 72 3e 0d 0a 44 65 70 6c 6f self.<br>..Deplo
19e0: 79 69 6e 67 20 61 20 66 75 72 74 68 65 72 20 3c ying a further <
19f0: 62 3e 2e 70 72 6a 3c 2f 62 3e 20 66 69 6c 65 20 b>.prj</b> file
1a00: 64 65 73 63 72 69 62 69 6e 67 20 74 68 65 20 69 describing the i
1a10: 6e 74 65 6e 64 65 64 20 53 52 49 44 20 69 73 20 ntended SRID is
1a20: 74 68 65 20 75 73 75 61 6c 20 73 6f 6c 75 74 69 the usual soluti
1a30: 6f 6e 20 61 64 6f 70 74 65 64 20 62 79 20 45 53 on adopted by ES
1a40: 52 49 20 69 74 73 65 6c 66 2c 20 62 75 74 20 63 RI itself, but c
1a50: 6f 72 72 65 63 74 6c 79 20 70 61 72 73 69 6e 67 orrectly parsing
1a60: 20 74 68 65 73 65 20 65 78 74 72 61 20 66 69 6c these extra fil
1a70: 65 73 20 69 73 20 61 6e 20 75 73 75 61 6c 6c 79 es is an usually
1a80: 20 66 6c 69 6d 73 79 20 70 72 6f 63 65 73 73 20 flimsy process
1a90: 66 61 6c 6c 69 6e 67 20 6f 75 74 73 69 64 65 20 falling outside
1aa0: 72 65 61 6c 20 63 61 70 61 62 69 6c 69 74 69 65 real capabilitie
1ab0: 73 20 6f 66 20 6d 61 6e 79 20 74 68 69 72 64 20 s of many third
1ac0: 70 61 72 74 79 20 72 65 61 64 65 72 73 2e 0d 0a party readers...
1ad0: 3c 2f 74 64 3e 0d 0a 3c 74 64 3e 0d 0a 45 61 63 </td>..<td>..Eac
1ae0: 68 20 73 69 6e 67 6c 65 20 47 65 6f 6d 65 74 72 h single Geometr
1af0: 79 20 69 73 20 61 6c 6c 6f 77 65 64 20 74 6f 20 y is allowed to
1b00: 66 72 65 65 6c 79 20 64 65 66 69 6e 65 20 69 74 freely define it
1b10: 73 20 6f 77 6e 20 53 52 49 44 2c 20 61 73 20 77 s own SRID, as w
1b20: 65 6c 6c 20 61 73 20 64 65 66 69 6e 69 6e 67 20 ell as defining
1b30: 74 68 65 20 53 52 49 44 20 66 6f 72 20 74 68 65 the SRID for the
1b40: 20 77 68 6f 6c 65 20 6c 61 79 65 72 2e 0d 0a 3c whole layer...<
1b50: 2f 74 64 3e 0d 0a 3c 74 64 3e 0d 0a 41 63 63 6f /td>..<td>..Acco
1b60: 72 64 69 6e 67 6c 79 20 74 6f 20 52 46 43 20 37 rdingly to RFC 7
1b70: 39 34 36 20 61 6c 6c 20 63 6f 6f 72 64 69 6e 61 946 all coordina
1b80: 74 65 73 20 61 72 65 20 61 6c 77 61 79 73 20 65 tes are always e
1b90: 78 70 65 74 65 64 20 74 6f 20 62 65 20 65 78 70 xpeted to be exp
1ba0: 72 65 73 73 65 64 20 61 73 20 3c 62 3e 6c 6f 6e ressed as <b>lon
1bb0: 67 69 74 75 65 73 3c 2f 62 3e 20 61 6e 64 20 3c gitues</b> and <
1bc0: 62 3e 6c 61 74 69 74 75 64 65 73 3c 2f 62 3e 20 b>latitudes</b>
1bd0: 28 28 69 2e 65 3a 20 78 2d 70 6f 73 69 74 69 6f ((i.e: x-positio
1be0: 6e 20 61 6e 64 20 79 2d 70 6f 73 69 74 69 6f 6e n and y-position
1bf0: 29 2e 3c 62 72 3e 0d 0a 53 6f 20 61 6e 79 20 63 ).<br>..So any c
1c00: 61 6e 6f 6e 69 63 61 6c 20 47 65 6f 4a 53 4f 4e anonical GeoJSON
1c10: 20 66 69 6c 65 20 69 73 20 61 6c 77 61 79 73 20 file is always
1c20: 65 78 70 65 63 74 65 64 20 74 6f 20 72 65 66 65 expected to refe
1c30: 72 65 6e 63 65 20 3c 62 3e 53 52 49 44 3d 34 33 rence <b>SRID=43
1c40: 32 36 20 57 47 53 20 38 34 3c 2f 62 3e 20 28 69 26 WGS 84</b> (i
1c50: 2e 65 2e 20 74 68 65 20 53 52 49 44 20 69 73 20 .e. the SRID is
1c60: 3c 62 3e 6e 6f 74 3c 2f 62 3e 20 73 74 6f 72 65 <b>not</b> store
1c70: 64 20 77 69 74 68 69 6e 20 74 68 65 20 47 65 6f d within the Geo
1c80: 4a 53 4f 4e 20 66 69 6c 65 29 2e 3c 62 72 3e 3c JSON file).<br><
1c90: 62 72 3e 0d 0a 55 73 69 6e 67 20 61 6e 79 20 6f br>..Using any o
1ca0: 74 68 65 72 20 53 52 49 44 20 69 73 20 74 65 63 ther SRID is tec
1cb0: 68 6e 69 63 61 6c 6c 79 20 70 6f 73 73 69 62 6c hnically possibl
1cc0: 65 2c 20 62 75 74 20 72 65 71 75 69 72 65 73 20 e, but requires
1cd0: 61 20 63 6f 6e 76 65 6e 74 69 6f 6e 61 6c 20 61 a conventional a
1ce0: 67 72 65 65 6d 65 6e 74 20 62 65 74 77 65 65 6e greement between
1cf0: 20 77 72 69 74 65 72 73 20 61 6e 64 20 72 65 61 writers and rea
1d00: 64 65 72 73 2c 20 62 75 74 20 61 6c 6c 20 74 68 ders, but all th
1d10: 69 73 20 69 73 20 73 75 72 65 6c 79 20 6f 75 74 is is surely out
1d20: 73 69 64 65 20 74 68 65 20 73 74 61 6e 64 61 72 side the standar
1d30: 64 20 61 6e 64 20 77 69 6c 6c 20 73 75 72 65 6c d and will surel
1d40: 79 20 69 6d 70 61 69 72 20 74 68 65 20 75 6e 69 y impair the uni
1d50: 76 65 72 73 61 6c 20 70 6f 72 74 61 62 69 6c 69 versal portabili
1d60: 74 79 20 6f 66 20 61 6e 79 20 6e 6f 6e 20 63 61 ty of any non ca
1d70: 6e 6f 6e 69 63 61 6c 20 66 69 6c 65 2e 0d 0a 3c nonical file...<
1d80: 2f 74 64 3e 0d 0a 3c 74 64 3e 0d 0a 54 68 65 20 /td>..<td>..The
1d90: 75 6e 69 71 75 65 20 65 66 66 65 63 74 69 76 65 unique effective
1da0: 20 73 6f 6c 75 74 69 6f 6e 20 69 73 20 74 68 65 solution is the
1db0: 20 6f 6e 65 20 61 64 6f 70 74 65 64 20 62 79 20 one adopted by
1dc0: 47 4d 4c 2e 3c 62 72 3e 0d 0a 42 6f 74 68 20 53 GML.<br>..Both S
1dd0: 68 61 70 65 66 69 6c 65 20 61 6e 64 20 47 65 6f hapefile and Geo
1de0: 4a 53 4f 4e 20 61 72 65 20 63 6c 65 61 72 6c 79 JSON are clearly
1df0: 20 69 6e 66 65 72 69 6f 72 20 75 6e 64 65 72 20 inferior under
1e00: 74 68 69 73 20 70 65 63 75 6c 69 61 72 20 61 73 this peculiar as
1e10: 70 65 63 74 2e 0d 0a 3c 2f 74 64 3e 0d 0a 3c 2f pect...</td>..</
1e20: 74 72 3e 0d 0a 3c 74 72 3e 0d 0a 3c 74 68 3e 4e tr>..<tr>..<th>N
1e30: 6f 6e 2d 73 70 61 74 69 61 6c 20 61 74 74 72 69 on-spatial attri
1e40: 62 75 74 65 73 3c 2f 74 68 3e 0d 0a 3c 74 64 3e butes</th>..<td>
1e50: 0d 0a 3c 75 6c 3e 0d 0a 3c 6c 69 3e 43 48 41 52 ..<ul>..<li>CHAR
1e60: 20 28 6c 69 6d 69 74 65 64 20 74 6f 20 6d 61 78 (limited to max
1e70: 2e 20 32 35 34 20 62 79 74 65 73 29 3c 2f 6c 69 . 254 bytes)</li
1e80: 3e 0d 0a 3c 6c 69 3e 4e 55 4d 42 45 52 20 28 72 >..<li>NUMBER (r
1e90: 65 70 72 65 73 65 6e 74 65 64 20 62 79 20 61 6e epresented by an
1ea0: 20 41 53 43 49 49 20 73 74 72 69 6e 67 20 6f 66 ASCII string of
1eb0: 20 6d 61 78 2e 20 33 32 20 62 79 74 65 73 29 3c max. 32 bytes)<
1ec0: 2f 6c 69 3e 0d 0a 3c 6c 69 3e 44 41 54 45 20 28 /li>..<li>DATE (
1ed0: 59 59 59 59 4d 4d 44 44 29 3c 2f 6c 69 3e 0d 0a YYYYMMDD)</li>..
1ee0: 3c 6c 69 3e 4c 4f 47 49 43 41 4c 20 28 54 2f 46 <li>LOGICAL (T/F
1ef0: 29 3c 2f 6c 69 3e 0d 0a 3c 2f 75 6c 3e 0d 0a 3c )</li>..</ul>..<
1f00: 62 72 3e 0d 0a 3c 75 3e 4e 6f 74 65 3c 2f 75 3e br>..<u>Note</u>
1f10: 3a 20 61 6c 6c 20 61 74 74 72 69 62 75 74 65 20 : all attribute
1f20: 6e 61 6d 65 73 20 61 72 65 20 6c 69 6d 69 74 65 names are limite
1f30: 64 20 74 6f 20 61 20 6c 65 6e 67 74 68 20 6f 66 d to a length of
1f40: 20 6d 61 78 2e 20 31 30 20 62 79 74 65 73 2e 20 max. 10 bytes.
1f50: 54 68 65 72 65 20 69 73 20 6e 6f 20 73 61 66 65 There is no safe
1f60: 20 77 61 79 20 66 6f 72 20 64 65 63 6c 61 72 69 way for declari
1f70: 6e 67 20 3c 62 3e 4e 55 4c 4c 3c 2f 62 3e 20 76 ng <b>NULL</b> v
1f80: 61 6c 75 65 73 2e 0d 0a 3c 2f 74 64 3e 0d 0a 3c alues...</td>..<
1f90: 74 64 3e 0d 0a 41 6e 79 20 70 6f 73 73 69 62 6c td>..Any possibl
1fa0: 65 20 64 61 74 61 74 79 70 65 20 79 6f 75 20 63 e datatype you c
1fb0: 61 6e 20 69 6d 61 67 69 6e 65 2e 3c 62 72 3e 0d an imagine.<br>.
1fc0: 0a 41 6e 64 20 64 65 66 69 6e 69 6e 67 20 66 75 .And defining fu
1fd0: 72 74 68 65 72 20 64 65 72 69 76 65 64 20 64 61 rther derived da
1fe0: 74 61 74 79 70 65 73 20 69 73 20 61 6e 20 6f 70 tatypes is an op
1ff0: 74 69 6f 6e 20 73 75 70 70 6f 72 74 65 64 20 62 tion supported b
2000: 79 20 74 68 65 20 58 4d 4c 20 53 63 68 65 6d 61 y the XML Schema
2010: 2e 3c 62 72 3e 3c 62 72 3e 0d 0a 3c 75 3e 4e 6f .<br><br>..<u>No
2020: 74 65 3c 2f 75 3e 3a 20 61 74 74 72 69 62 75 74 te</u>: attribut
2030: 65 20 6e 61 6d 65 73 20 61 6e 64 20 74 65 78 74 e names and text
2040: 20 76 61 6c 75 65 73 20 63 61 6e 20 68 61 76 65 values can have
2050: 20 61 6e 79 20 61 72 62 69 74 72 61 72 79 20 6c any arbitrary l
2060: 65 6e 67 74 68 2e 0d 0a 3c 2f 74 64 3e 0d 0a 3c ength...</td>..<
2070: 74 64 3e 0d 0a 3c 75 6c 3e 0d 0a 3c 6c 69 3e 74 td>..<ul>..<li>t
2080: 65 78 74 20 28 75 6e 63 6f 6e 73 74 72 61 69 6e ext (unconstrain
2090: 65 64 20 6c 65 6e 67 74 68 29 3c 2f 6c 69 3e 0d ed length)</li>.
20a0: 0a 3c 6c 69 3e 6e 75 6d 62 65 72 3c 2f 6c 69 3e .<li>number</li>
20b0: 0d 0a 3c 6c 69 3e 6e 75 6c 6c 3c 2f 6c 69 3e 0d ..<li>null</li>.
20c0: 0a 3c 6c 69 3e 74 72 75 65 3c 2f 6c 69 3e 0d 0a .<li>true</li>..
20d0: 3c 6c 69 3e 66 61 6c 73 65 3c 2f 6c 69 3e 0d 0a <li>false</li>..
20e0: 3c 2f 75 6c 3e 0d 0a 3c 62 72 3e 0d 0a 3c 75 3e </ul>..<br>..<u>
20f0: 4e 6f 74 65 3c 2f 75 3e 3a 20 61 74 74 72 69 62 Note</u>: attrib
2100: 75 74 65 20 6e 61 6d 65 73 20 20 63 61 6e 20 68 ute names can h
2110: 61 76 65 20 61 6e 79 20 61 72 62 69 74 72 61 72 ave any arbitrar
2120: 79 20 6c 65 6e 67 74 68 2e 0d 0a 3c 2f 74 64 3e y length...</td>
2130: 0d 0a 3c 74 64 3e 0d 0a 3c 75 6c 3e 0d 0a 3c 6c ..<td>..<ul>..<l
2140: 69 3e 53 68 61 70 65 66 69 6c 65 20 28 6f 72 20 i>Shapefile (or
2150: 6d 6f 72 65 20 70 72 65 63 69 73 65 6c 79 20 69 more precisely i
2160: 6e 20 74 68 69 73 20 63 61 73 65 20 44 42 46 29 n this case DBF)
2170: 20 63 6c 65 61 72 6c 79 20 73 75 66 66 65 72 73 clearly suffers
2180: 20 66 72 6f 6d 20 74 6f 6f 20 6d 61 6e 79 20 75 from too many u
2190: 6e 70 6c 65 61 73 61 6e 74 20 6c 69 6d 69 74 61 npleasant limita
21a0: 74 69 6f 6e 73 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 tions.</li>..<li
21b0: 3e 47 4d 4c 20 28 6d 6f 72 65 20 70 72 65 63 69 >GML (more preci
21c0: 73 65 6c 79 20 58 4d 4c 29 20 63 61 6e 20 65 66 sely XML) can ef
21d0: 66 65 63 74 69 76 65 6c 79 20 73 75 70 70 6f 72 fectively suppor
21e0: 74 20 61 6e 20 69 6d 70 72 65 73 73 69 76 65 20 t an impressive
21f0: 66 6c 65 78 69 62 69 6c 69 74 79 20 62 75 74 20 flexibility but
2200: 63 61 6e 20 65 61 73 69 6c 79 20 62 65 63 6f 6d can easily becom
2210: 65 20 74 6f 6f 20 63 6f 6d 70 6c 65 78 20 61 6e e too complex an
2220: 64 20 64 69 66 66 65 63 75 74 20 74 6f 20 70 61 d diffecut to pa
2230: 72 73 65 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 47 rse.</li>..<li>G
2240: 65 6f 4a 53 4f 4e 20 6f 66 66 65 72 73 20 61 20 eoJSON offers a
2250: 77 65 6c 6c 20 62 61 6c 61 6e 63 65 64 20 6d 69 well balanced mi
2260: 78 3b 20 69 74 27 73 20 73 74 69 6c 6c 20 72 65 x; it's still re
2270: 61 73 6f 6e 61 62 6c 79 20 73 69 6d 70 6c 65 20 asonably simple
2280: 61 6e 64 20 69 74 27 73 20 70 6f 77 65 72 66 75 and it's powerfu
2290: 6c 20 61 74 20 74 68 65 20 73 61 6d 65 20 74 69 l at the same ti
22a0: 6d 65 2e 3c 2f 6c 69 3e 0d 0a 3c 2f 75 6c 3e 0d me.</li>..</ul>.
22b0: 0a 3c 2f 74 64 3e 0d 0a 3c 2f 74 72 3e 0d 0a 3c .</td>..</tr>..<
22c0: 74 72 3e 0d 0a 3c 74 64 20 61 6c 69 67 6e 3d 22 tr>..<td align="
22d0: 63 65 6e 74 65 72 22 3e 0d 0a 3c 62 3e 43 68 61 center">..<b>Cha
22e0: 72 73 65 74 20 65 6e 63 6f 64 69 6e 67 3c 2f 62 rset encoding</b
22f0: 3e 0d 0a 3c 74 61 62 6c 65 20 63 65 6c 6c 70 61 >..<table cellpa
2300: 64 64 69 6e 67 3d 22 34 22 20 63 65 6c 6c 73 70 dding="4" cellsp
2310: 61 63 69 6e 67 3d 22 34 22 3e 0d 0a 3c 74 72 3e acing="4">..<tr>
2320: 3c 74 64 20 61 6c 69 67 6e 3d 22 6c 65 66 74 22 <td align="left"
2330: 3e 0d 0a 73 65 65 20 74 68 65 20 3c 61 20 68 72 >..see the <a hr
2340: 65 66 3d 22 68 74 74 70 3a 2f 2f 77 77 77 2e 67 ef="http://www.g
2350: 61 69 61 2d 67 69 73 2e 69 74 2f 67 61 69 61 2d aia-gis.it/gaia-
2360: 73 69 6e 73 2f 73 70 61 74 69 61 6c 69 74 65 2d sins/spatialite-
2370: 63 6f 6f 6b 62 6f 6f 6b 2d 35 2f 63 6f 6f 6b 62 cookbook-5/cookb
2380: 6f 6f 6b 5f 74 6f 70 69 63 73 2e 30 31 2e 68 74 ook_topics.01.ht
2390: 6d 6c 23 74 6f 70 69 63 5f 41 62 6f 75 74 5f 43 ml#topic_About_C
23a0: 68 61 72 73 65 74 5f 45 6e 63 6f 64 69 6e 67 22 harset_Encoding"
23b0: 3e 43 6f 6f 6b 42 6f 6f 6b 3c 2f 61 3e 20 66 6f >CookBook</a> fo
23c0: 72 20 6d 6f 72 65 20 6f 6e 20 74 68 69 73 20 74 r more on this t
23d0: 6f 70 69 63 2e 0d 0a 3c 2f 74 64 3e 3c 2f 74 72 opic...</td></tr
23e0: 3e 0d 0a 3c 2f 74 61 62 6c 65 3e 0d 0a 3c 2f 74 >..</table>..</t
23f0: 64 3e 0d 0a 3c 74 64 3e 0d 0a 4e 6f 74 20 69 6e d>..<td>..Not in
2400: 74 65 72 6e 61 6c 6c 79 20 64 65 66 69 6e 65 64 ternally defined
2410: 20 62 79 20 74 68 65 20 53 68 61 70 65 66 69 6c by the Shapefil
2420: 65 20 69 74 73 65 6c 66 2e 3c 62 72 3e 0d 0a 41 e itself.<br>..A
2430: 74 74 65 6d 70 74 69 6e 67 20 74 6f 20 67 75 65 ttempting to gue
2440: 73 73 20 74 68 65 20 61 70 70 72 6f 70 72 69 61 ss the appropria
2450: 74 65 20 63 68 61 72 73 65 74 20 65 6e 63 6f 64 te charset encod
2460: 69 6e 67 20 72 65 71 75 69 72 65 64 20 62 79 20 ing required by
2470: 73 6f 6d 65 20 53 68 61 70 65 66 69 6c 65 20 69 some Shapefile i
2480: 73 20 6d 6f 72 65 20 61 20 6d 61 67 69 63 20 61 s more a magic a
2490: 72 74 20 74 68 61 6e 20 72 61 74 69 6f 6e 61 6c rt than rational
24a0: 20 73 63 69 65 6e 63 65 2e 0d 0a 3c 2f 74 64 3e science...</td>
24b0: 0d 0a 3c 74 64 3e 0d 0a 41 6c 77 61 79 73 20 69 ..<td>..Always i
24c0: 6e 74 65 72 6e 61 6c 6c 79 20 64 65 66 69 6e 65 nternally define
24d0: 64 20 62 79 20 74 68 65 20 47 4d 4c 2f 58 4d 4c d by the GML/XML
24e0: 20 66 69 6c 65 20 69 74 73 65 6c 66 2e 0d 0a 3c file itself...<
24f0: 2f 74 64 3e 0d 0a 3c 74 64 3e 0d 0a 52 46 43 20 /td>..<td>..RFC
2500: 37 39 34 36 20 73 74 72 69 63 74 6c 79 20 72 65 7946 strictly re
2510: 71 75 69 72 65 73 20 74 68 61 74 20 61 6c 6c 20 quires that all
2520: 47 65 6f 4a 53 4f 4e 20 66 69 6c 65 73 20 6d 75 GeoJSON files mu
2530: 73 74 20 62 65 20 65 6e 63 6f 64 65 64 20 61 73 st be encoded as
2540: 20 3c 62 3e 55 54 46 2d 38 3c 2f 62 3e 3c 62 72 <b>UTF-8</b><br
2550: 3e 3c 62 72 3e 0d 0a 49 6e 20 70 75 72 65 20 74 ><br>..In pure t
2560: 68 65 6f 72 79 20 62 6f 74 68 20 3c 62 3e 55 54 heory both <b>UT
2570: 46 2d 31 36 3c 2f 62 3e 20 61 6e 64 20 3c 62 3e F-16</b> and <b>
2580: 55 54 46 2d 33 32 3c 2f 62 3e 20 63 6f 75 6c 64 UTF-32</b> could
2590: 20 62 65 20 75 73 65 64 20 66 6f 72 20 65 6e 63 be used for enc
25a0: 6f 64 69 6e 67 20 61 20 6c 65 67 69 74 69 6d 61 oding a legitima
25b0: 74 65 20 47 65 6f 4a 53 4f 4e 20 66 69 6c 65 2c te GeoJSON file,
25c0: 20 62 75 74 20 73 75 63 68 20 6f 70 74 69 6f 6e but such option
25d0: 73 20 73 65 65 6d 73 20 74 6f 20 62 65 20 76 65 s seems to be ve
25e0: 72 79 20 72 61 72 65 6c 79 20 28 69 66 20 65 76 ry rarely (if ev
25f0: 65 72 29 20 61 64 6f 70 74 65 64 20 69 6e 20 72 er) adopted in r
2600: 65 61 6c 20 77 6f 72 6c 64 2e 0d 0a 3c 2f 74 64 eal world...</td
2610: 3e 0d 0a 3c 74 64 3e 0d 0a 3c 75 6c 3e 0d 0a 3c >..<td>..<ul>..<
2620: 6c 69 3e 53 68 61 70 65 66 69 6c 65 73 20 6c 65 li>Shapefiles le
2630: 61 76 65 73 20 61 20 6c 6f 74 20 74 6f 20 62 65 aves a lot to be
2640: 20 64 65 73 69 72 65 64 2c 20 61 6e 64 20 6c 61 desired, and la
2650: 63 6b 20 6f 66 20 64 65 66 69 6e 65 64 20 63 68 ck of defined ch
2660: 61 72 73 65 74 20 65 6e 63 6f 64 69 6e 67 20 63 arset encoding c
2670: 61 75 73 65 73 20 6d 61 6e 79 20 73 65 72 69 6f auses many serio
2680: 75 73 20 70 6f 72 74 61 62 69 6c 69 74 79 20 69 us portability i
2690: 73 73 75 65 73 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 ssues.</li>..<li
26a0: 3e 47 4d 4c 2f 58 4d 4c 20 6e 69 63 65 6c 79 20 >GML/XML nicely
26b0: 73 75 70 70 6f 72 74 73 20 61 6e 79 20 70 6f 73 supports any pos
26c0: 73 69 62 6c 65 20 63 68 61 72 73 65 74 20 69 6e sible charset in
26d0: 20 74 68 65 20 6d 6f 73 74 20 66 6c 65 78 69 62 the most flexib
26e0: 6c 65 20 28 61 6e 64 20 73 61 66 65 29 0d 0a 77 le (and safe)..w
26f0: 61 79 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 4f 6e 63 ay</li>..<li>Onc
2700: 65 20 61 67 61 69 6e 2c 20 47 65 6f 4a 53 4f 4e e again, GeoJSON
2710: 20 69 73 20 73 74 72 61 69 67 68 74 66 6f 72 77 is straightforw
2720: 61 72 64 20 61 6e 64 20 73 69 6d 70 6c 65 2c 20 ard and simple,
2730: 62 75 74 20 72 65 61 6c 6c 79 20 65 66 66 65 63 but really effec
2740: 74 69 76 65 2e 3c 2f 6c 69 3e 0d 0a 3c 2f 75 6c tive.</li>..</ul
2750: 3e 0d 0a 3c 2f 74 64 3e 0d 0a 3c 2f 74 72 3e 0d >..</td>..</tr>.
2760: 0a 3c 2f 74 61 62 6c 65 3e 0d 0a 3c 68 32 3e 53 .</table>..<h2>S
2770: 6b 65 6c 65 74 61 6c 20 47 65 6f 4a 53 4f 4e 20 keletal GeoJSON
2780: 61 6e 61 74 68 6f 6d 79 3c 2f 68 32 3e 0d 0a 3c anathomy</h2>..<
2790: 76 65 72 62 61 74 69 6d 3e 0d 0a 7b 0d 0a 20 20 verbatim>..{..
27a0: 20 22 74 79 70 65 22 3a 20 22 46 65 61 74 75 72 "type": "Featur
27b0: 65 43 6f 6c 6c 65 63 74 69 6f 6e 22 2c 0d 0a 20 eCollection",..
27c0: 20 20 22 66 65 61 74 75 72 65 73 22 3a 20 0d 0a "features": ..
27d0: 20 20 20 5b 7b 0d 0a 20 20 20 20 20 20 20 22 74 [{.. "t
27e0: 79 70 65 22 3a 20 22 46 65 61 74 75 72 65 22 2c ype": "Feature",
27f0: 0d 0a 20 20 20 20 20 20 20 22 67 65 6f 6d 65 74 .. "geomet
2800: 72 79 22 3a 20 0d 0a 20 20 20 20 20 20 20 7b 0d ry": .. {.
2810: 0a 20 20 20 20 20 20 20 20 20 20 20 22 74 79 70 . "typ
2820: 65 22 3a 20 22 50 6f 69 6e 74 22 2c 0d 0a 20 20 e": "Point",..
2830: 20 20 20 20 20 20 20 20 20 22 63 6f 6f 72 64 69 "coordi
2840: 6e 61 74 65 73 22 3a 20 5b 31 30 32 2e 30 2c 20 nates": [102.0,
2850: 30 2e 35 5d 0d 0a 20 20 20 20 20 20 20 7d 2c 0d 0.5].. },.
2860: 0a 20 20 20 20 20 20 20 22 70 72 6f 70 65 72 74 . "propert
2870: 69 65 73 22 3a 20 0d 0a 20 20 20 20 20 20 20 7b ies": .. {
2880: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 22 70 72 .. "pr
2890: 6f 70 30 22 3a 20 22 76 61 6c 75 65 30 22 0d 0a op0": "value0"..
28a0: 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 20 7d 2c }.. },
28b0: 20 0d 0a 20 20 20 20 7b 0d 0a 20 20 20 20 20 20 .. {..
28c0: 20 22 74 79 70 65 22 3a 20 22 46 65 61 74 75 72 "type": "Featur
28d0: 65 22 2c 0d 0a 20 20 20 20 20 20 20 22 67 65 6f e",.. "geo
28e0: 6d 65 74 72 79 22 3a 20 0d 0a 20 20 20 20 20 20 metry": ..
28f0: 20 7b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 22 {.. "
2900: 74 79 70 65 22 3a 20 22 4c 69 6e 65 53 74 72 69 type": "LineStri
2910: 6e 67 22 2c 0d 0a 20 20 20 20 20 20 20 20 20 20 ng",..
2920: 20 22 63 6f 6f 72 64 69 6e 61 74 65 73 22 3a 20 "coordinates":
2930: 0d 0a 20 20 20 20 20 20 20 20 20 20 5b 0d 0a 20 .. [..
2940: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5b 31 [1
2950: 30 32 2e 30 2c 20 30 2e 30 5d 2c 0d 0a 20 20 20 02.0, 0.0],..
2960: 20 20 20 20 20 20 20 20 20 20 20 20 5b 31 30 33 [103
2970: 2e 30 2c 20 31 2e 30 5d 2c 0d 0a 20 20 20 20 20 .0, 1.0],..
2980: 20 20 20 20 20 20 20 20 20 20 5b 31 30 34 2e 30 [104.0
2990: 2c 20 30 2e 30 5d 2c 0d 0a 20 20 20 20 20 20 20 , 0.0],..
29a0: 20 20 20 20 20 20 20 20 5b 31 30 35 2e 30 2c 20 [105.0,
29b0: 31 2e 30 5d 0d 0a 20 20 20 20 20 20 20 20 20 20 1.0]..
29c0: 20 5d 0d 0a 20 20 20 20 20 20 20 7d 2c 0d 0a 20 ].. },..
29d0: 20 20 20 20 20 20 22 70 72 6f 70 65 72 74 69 65 "propertie
29e0: 73 22 3a 20 0d 0a 20 20 20 20 20 20 20 7b 0d 0a s": .. {..
29f0: 20 20 20 20 20 20 20 20 20 20 20 22 70 72 6f 70 "prop
2a00: 30 22 3a 20 22 76 61 6c 75 65 30 22 2c 0d 0a 20 0": "value0",..
2a10: 20 20 20 20 20 20 20 20 20 20 22 70 72 6f 70 31 "prop1
2a20: 22 3a 20 30 2e 30 0d 0a 20 20 20 20 20 20 20 7d ": 0.0.. }
2a30: 0d 0a 20 20 20 20 7d 2c 20 0d 0a 20 20 20 20 7b .. }, .. {
2a40: 0d 0a 20 20 20 20 20 20 20 22 74 79 70 65 22 3a .. "type":
2a50: 20 22 46 65 61 74 75 72 65 22 2c 0d 0a 20 20 20 "Feature",..
2a60: 20 20 20 20 22 67 65 6f 6d 65 74 72 79 22 3a 20 "geometry":
2a70: 0d 0a 20 20 20 20 20 20 20 7b 0d 0a 20 20 20 20 .. {..
2a80: 20 20 20 20 20 20 20 22 74 79 70 65 22 3a 20 22 "type": "
2a90: 50 6f 6c 79 67 6f 6e 22 2c 0d 0a 20 20 20 20 20 Polygon",..
2aa0: 20 20 20 20 20 20 22 63 6f 6f 72 64 69 6e 61 74 "coordinat
2ab0: 65 73 22 3a 20 0d 0a 20 20 20 20 20 20 20 20 20 es": ..
2ac0: 20 20 5b 0d 0a 20 20 20 20 20 20 20 20 20 20 20 [..
2ad0: 20 20 20 20 5b 0d 0a 20 20 20 20 20 20 20 20 20 [..
2ae0: 20 20 20 20 20 20 20 20 20 20 5b 31 30 30 2e 30 [100.0
2af0: 2c 20 30 2e 30 5d 2c 0d 0a 20 20 20 20 20 20 20 , 0.0],..
2b00: 20 20 20 20 20 20 20 20 20 20 20 20 5b 31 30 31 [101
2b10: 2e 30 2c 20 30 2e 30 5d 2c 0d 0a 20 20 20 20 20 .0, 0.0],..
2b20: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5b 31 [1
2b30: 30 31 2e 30 2c 20 31 2e 30 5d 2c 0d 0a 20 20 20 01.0, 1.0],..
2b40: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
2b50: 5b 31 30 30 2e 30 2c 20 31 2e 30 5d 2c 0d 0a 20 [100.0, 1.0],..
2b60: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
2b70: 20 20 5b 31 30 30 2e 30 2c 20 30 2e 30 5d 0d 0a [100.0, 0.0]..
2b80: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 5d ]
2b90: 0d 0a 20 20 20 20 20 20 20 20 20 20 20 5d 0d 0a .. ]..
2ba0: 20 20 20 20 20 20 20 7d 2c 0d 0a 20 20 20 20 20 },..
2bb0: 20 20 22 70 72 6f 70 65 72 74 69 65 73 22 3a 20 "properties":
2bc0: 0d 0a 20 20 20 20 20 20 20 7b 0d 0a 20 20 20 20 .. {..
2bd0: 20 20 20 20 20 20 20 22 70 72 6f 70 30 22 3a 20 "prop0":
2be0: 22 76 61 6c 75 65 30 22 2c 0d 0a 20 20 20 20 20 "value0",..
2bf0: 20 20 20 20 20 20 22 70 72 6f 70 31 22 3a 20 7b "prop1": {
2c00: 22 74 68 69 73 22 3a 20 22 74 68 61 74 22 7d 0d "this": "that"}.
2c10: 0a 20 20 20 20 20 20 20 7d 0d 0a 20 20 20 7d 5d . }.. }]
2c20: 0d 0a 7d 0d 0a 3c 2f 76 65 72 62 61 74 69 6d 3e ..}..</verbatim>
2c30: 0d 0a 41 73 20 79 6f 75 20 63 61 6e 20 65 61 73 ..As you can eas
2c40: 69 6c 79 20 6e 6f 74 69 63 65 2c 20 47 65 6f 4a ily notice, GeoJ
2c50: 53 4f 4e 20 68 61 73 20 61 20 70 6c 61 69 6e 20 SON has a plain
2c60: 72 65 67 75 6c 61 72 20 73 74 72 75 63 74 75 72 regular structur
2c70: 65 20 61 6e 64 20 69 73 20 64 65 63 69 73 65 6c e and is decisel
2c80: 79 20 6d 6f 73 74 20 63 6f 6e 63 69 73 65 20 61 y most concise a
2c90: 6e 64 20 6c 65 73 73 20 76 65 72 62 6f 73 65 20 nd less verbose
2ca0: 74 68 61 6e 20 47 4d 4c 2f 58 4d 4c 3a 0d 0a 3c than GML/XML:..<
2cb0: 75 6c 3e 0d 0a 3c 6c 69 3e 45 76 65 72 79 20 47 ul>..<li>Every G
2cc0: 65 6f 4a 53 4f 4e 20 66 69 6c 65 20 6d 75 73 74 eoJSON file must
2cd0: 20 63 6f 6e 74 61 69 6e 20 61 20 3c 62 3e 46 65 contain a <b>Fe
2ce0: 61 74 75 72 65 43 6f 6c 6c 65 63 74 69 6f 6e 3c atureCollection<
2cf0: 2f 62 3e 20 6f 62 6a 65 63 74 2e 0d 0a 3c 75 6c /b> object...<ul
2d00: 3e 0d 0a 3c 6c 69 3e 41 20 20 3c 62 3e 46 65 61 >..<li>A <b>Fea
2d10: 74 75 72 65 43 6f 6c 6c 65 63 74 69 6f 6e 3c 2f tureCollection</
2d20: 62 3e 20 63 6f 6e 74 61 69 6e 73 20 6f 6e 65 20 b> contains one
2d30: 6f 72 20 6d 6f 72 65 20 69 6e 64 69 76 69 64 75 or more individu
2d40: 61 6c 20 3c 62 3e 46 65 61 74 75 72 65 3c 2f 62 al <b>Feature</b
2d50: 3e 20 6f 62 6a 65 63 74 73 2e 0d 0a 3c 75 6c 3e > objects...<ul>
2d60: 0d 0a 3c 6c 69 3e 45 61 63 68 20 3c 62 3e 46 65 ..<li>Each <b>Fe
2d70: 61 74 75 72 65 3c 2f 62 3e 20 69 73 20 65 78 70 ature</b> is exp
2d80: 65 63 74 65 64 20 74 6f 20 64 65 63 6c 61 72 65 ected to declare
2d90: 20 61 20 3c 62 3e 47 65 6f 6d 65 74 72 79 3c 2f a <b>Geometry</
2da0: 62 3e 20 61 6e 64 20 61 20 3c 62 3e 70 72 6f 70 b> and a <b>prop
2db0: 65 72 74 69 65 73 3c 2f 62 3e 20 61 72 72 61 79 erties</b> array
2dc0: 2e 0d 0a 3c 75 6c 3e 0d 0a 3c 6c 69 3e 45 61 63 ...<ul>..<li>Eac
2dd0: 68 20 70 72 6f 70 65 72 74 79 20 63 6f 72 65 73 h property cores
2de0: 70 6f 6e 64 73 20 74 6f 20 61 6e 20 61 74 74 72 ponds to an attr
2df0: 69 62 75 74 65 20 77 69 74 68 20 61 20 3c 62 3e ibute with a <b>
2e00: 6e 61 6d 65 3c 2f 62 3e 20 61 6e 64 20 61 20 3c name</b> and a <
2e10: 62 3e 76 61 6c 75 65 3c 2f 62 3e 3c 2f 6c 69 3e b>value</b></li>
2e20: 2e 0d 0a 3c 2f 6c 69 3e 3c 2f 75 6c 3e 0d 0a 3c ...</li></ul>..<
2e30: 2f 6c 69 3e 3c 2f 75 6c 3e 0d 0a 3c 2f 6c 69 3e /li></ul>..</li>
2e40: 3c 2f 75 6c 3e 0d 0a 3c 2f 75 6c 3e 0d 0a 3c 68 </ul>..</ul>..<h
2e50: 33 3e 53 68 6f 72 74 20 63 6f 6e 63 6c 75 73 69 3>Short conclusi
2e60: 6f 6e 73 3c 2f 68 33 3e 0d 0a 47 65 6f 4a 53 4f ons</h3>..GeoJSO
2e70: 4e 20 69 73 20 77 69 64 65 6c 79 20 61 64 6f 70 N is widely adop
2e80: 74 65 64 20 62 79 20 6d 61 6e 79 20 77 65 62 2d ted by many web-
2e90: 61 70 70 73 3b 20 62 65 69 6e 67 20 61 20 6e 6f apps; being a no
2ea0: 74 61 74 69 6f 6e 20 64 69 72 65 63 74 6c 79 20 tation directly
2eb0: 62 61 73 65 64 20 6f 6e 20 3c 62 3e 4a 61 76 61 based on <b>Java
2ec0: 53 63 72 69 70 74 3c 2f 62 3e 20 69 74 20 68 61 Script</b> it ha
2ed0: 73 20 61 20 6e 61 74 75 72 61 6c 20 69 6e 74 65 s a natural inte
2ee0: 67 72 61 74 69 6f 6e 20 69 6e 20 70 6f 70 75 6c gration in popul
2ef0: 61 72 20 3c 69 3e 63 6c 69 65 6e 74 2d 73 69 64 ar <i>client-sid
2f00: 65 3c 2f 69 3e 20 4a 53 20 6c 69 62 72 61 72 69 e</i> JS librari
2f10: 65 73 20 73 75 63 68 20 61 73 20 3c 61 20 68 72 es such as <a hr
2f20: 65 66 3d 22 68 74 74 70 73 3a 2f 2f 65 6e 2e 77 ef="https://en.w
2f30: 69 6b 69 70 65 64 69 61 2e 6f 72 67 2f 77 69 6b ikipedia.org/wik
2f40: 69 2f 4f 70 65 6e 4c 61 79 65 72 73 22 3e 4f 70 i/OpenLayers">Op
2f50: 65 6e 4c 61 79 65 72 73 3c 2f 61 3e 20 61 6e 64 enLayers</a> and
2f60: 20 3c 61 20 68 72 65 66 3d 22 68 74 74 70 73 3a <a href="https:
2f70: 2f 2f 65 6e 2e 77 69 6b 69 70 65 64 69 61 2e 6f //en.wikipedia.o
2f80: 72 67 2f 77 69 6b 69 2f 4c 65 61 66 6c 65 74 5f rg/wiki/Leaflet_
2f90: 28 73 6f 66 74 77 61 72 65 29 22 3e 4c 65 61 66 (software)">Leaf
2fa0: 6c 65 74 3c 2f 61 3e 2e 3c 62 72 3e 0d 0a 49 74 let</a>.<br>..It
2fb0: 27 73 20 61 64 65 71 75 61 74 65 6c 79 20 73 75 's adequately su
2fc0: 70 70 6f 72 74 65 64 20 62 79 20 3c 61 20 68 72 pported by <a hr
2fd0: 65 66 3d 22 68 74 74 70 73 3a 2f 2f 65 6e 2e 77 ef="https://en.w
2fe0: 69 6b 69 70 65 64 69 61 2e 6f 72 67 2f 77 69 6b ikipedia.org/wik
2ff0: 69 2f 47 44 41 4c 22 3e 47 44 41 4c 3c 2f 61 3e i/GDAL">GDAL</a>
3000: 2c 20 61 6e 64 20 63 6f 6e 73 65 71 75 65 6e 74 , and consequent
3010: 6c 79 20 62 79 20 6d 61 6e 79 20 6f 74 68 65 72 ly by many other
3020: 73 20 66 72 65 65 2f 6c 69 62 72 65 20 73 77 20 s free/libre sw
3030: 63 6f 6d 70 6f 6e 65 6e 74 73 20 28 61 73 20 65 components (as e
3040: 2e 67 2e 20 3c 61 20 68 72 65 66 3d 22 68 74 74 .g. <a href="htt
3050: 70 73 3a 2f 2f 65 6e 2e 77 69 6b 69 70 65 64 69 ps://en.wikipedi
3060: 61 2e 6f 72 67 2f 77 69 6b 69 2f 4d 61 70 53 65 a.org/wiki/MapSe
3070: 72 76 65 72 3e 4d 61 70 53 65 72 76 65 72 22 3e rver>MapServer">
3080: 4d 61 70 53 65 72 76 65 72 3c 2f 61 3e 20 61 6e MapServer</a> an
3090: 64 20 3c 61 20 68 72 65 66 3d 22 68 74 74 70 73 d <a href="https
30a0: 3a 2f 2f 65 6e 2e 77 69 6b 69 70 65 64 69 61 2e ://en.wikipedia.
30b0: 6f 72 67 2f 77 69 6b 69 2f 47 65 6f 53 65 72 76 org/wiki/GeoServ
30c0: 65 72 22 3e 47 65 6f 53 65 72 76 65 72 3c 2f 61 er">GeoServer</a
30d0: 3e 29 2e 3c 62 72 3e 3c 62 72 3e 0d 0a 4f 75 74 >).<br><br>..Out
30e0: 73 69 64 65 20 74 68 65 20 77 65 62 2d 67 69 73 side the web-gis
30f0: 20 61 72 65 6e 61 20 47 65 6f 4a 53 4f 4e 20 73 arena GeoJSON s
3100: 74 69 6c 6c 20 68 61 73 20 6c 69 6d 69 74 65 64 till has limited
3110: 20 61 64 6f 70 74 69 6f 6e 2c 20 61 6e 64 20 69 adoption, and i
3120: 74 27 73 20 61 20 72 65 61 6c 20 70 69 74 79 20 t's a real pity
3130: 62 65 63 61 75 73 65 20 75 6e 64 65 72 20 6d 61 because under ma
3140: 6e 79 20 61 73 70 65 63 74 73 20 69 74 27 73 20 ny aspects it's
3150: 61 20 76 65 72 79 20 76 61 6c 69 64 20 66 75 6c a very valid ful
3160: 6c 20 72 65 70 6c 61 63 65 6d 65 6e 74 20 66 6f l replacement fo
3170: 72 20 74 68 65 20 6e 6f 77 61 64 61 79 73 20 69 r the nowadays i
3180: 72 72 65 6d 65 64 69 61 62 6c 79 20 6f 62 73 6f rremediably obso
3190: 6c 65 74 65 20 53 68 61 70 65 66 69 6c 65 2e 3c lete Shapefile.<
31a0: 62 72 3e 0d 0a 53 74 61 72 74 69 6e 67 20 73 69 br>..Starting si
31b0: 6e 63 65 20 76 65 72 73 69 6f 6e 20 3c 62 3e 35 nce version <b>5
31c0: 2e 30 2e 30 3c 2f 62 3e 20 53 70 61 74 69 61 4c .0.0</b> SpatiaL
31d0: 69 74 65 20 6f 66 66 65 72 73 20 66 75 6c 6c 20 ite offers full
31e0: 73 75 70 70 6f 72 74 73 20 74 6f 20 47 65 6f 4a supports to GeoJ
31f0: 53 4f 4e 20 61 73 20 64 65 66 69 6e 65 64 20 62 SON as defined b
3200: 79 20 52 46 43 20 37 39 34 36 2e 3c 62 72 3e 0d y RFC 7946.<br>.
3210: 0a 54 68 65 20 69 6d 70 6c 65 6d 65 6e 74 61 74 .The implementat
3220: 69 6f 6e 20 73 74 72 6f 6e 67 6c 79 20 72 65 73 ion strongly res
3230: 65 6d 62 6c 65 73 20 74 68 65 20 6f 6e 65 20 73 embles the one s
3240: 75 70 70 6f 72 74 65 64 20 62 79 20 61 6c 6c 20 upported by all
3250: 70 72 65 76 69 6f 75 73 20 76 65 72 73 69 6f 6e previous version
3260: 73 20 66 6f 72 20 53 68 61 70 65 66 69 6c 65 2c s for Shapefile,
3270: 20 61 6e 64 20 74 68 69 73 20 69 73 6e 27 74 20 and this isn't
3280: 61 74 20 61 6c 6c 20 73 75 72 70 72 69 73 69 6e at all surprisin
3290: 67 20 62 65 63 61 75 73 65 20 62 6f 74 68 20 74 g because both t
32a0: 68 65 6d 20 63 6f 76 65 72 20 74 68 65 20 73 61 hem cover the sa
32b0: 6d 65 20 66 75 6e 63 74 69 6f 6e 61 6c 20 61 72 me functional ar
32c0: 65 61 2e 0d 0a 3c 62 72 3e 3c 62 72 3e 0d 0a 3c ea...<br><br>..<
32d0: 68 72 3e 0d 0a 3c 68 31 3e 53 51 4c 20 66 75 6e hr>..<h1>SQL fun
32e0: 63 74 69 6f 6e 73 20 73 75 70 70 6f 72 74 69 6e ctions supportin
32f0: 67 20 47 65 6f 4a 53 4f 4e 3c 2f 68 31 3e 0d 0a g GeoJSON</h1>..
3300: 3c 68 33 3e 45 78 70 6f 72 74 69 6e 67 20 64 61 <h3>Exporting da
3310: 74 61 20 74 6f 20 47 65 6f 4a 53 4f 4e 3c 2f 68 ta to GeoJSON</h
3320: 33 3e 0d 0a 3c 76 65 72 62 61 74 69 6d 3e 0d 0a 3>..<verbatim>..
3330: 53 45 4c 45 43 54 20 45 78 70 6f 72 74 47 65 6f SELECT ExportGeo
3340: 4a 53 4f 4e 32 28 27 6d 79 74 61 62 6c 65 27 2c JSON2('mytable',
3350: 20 27 67 65 6f 6d 27 2c 20 27 2f 68 6f 6d 65 2f 'geom', '/home/
3360: 73 61 6e 64 72 6f 2f 6d 79 74 61 62 6c 65 2e 67 sandro/mytable.g
3370: 65 6f 6a 73 6f 6e 27 29 3b 0d 0a 2d 2d 2d 2d 2d eojson');..-----
3380: 2d 2d 2d 2d 0d 0a 31 32 33 34 0d 0a 0d 0a 53 45 ----..1234....SE
3390: 4c 45 43 54 20 45 78 70 6f 72 74 47 65 6f 4a 53 LECT ExportGeoJS
33a0: 4f 4e 32 28 27 6d 79 74 61 62 6c 65 27 2c 20 27 ON2('mytable', '
33b0: 67 65 6f 6d 27 2c 20 27 2f 68 6f 6d 65 2f 73 61 geom', '/home/sa
33c0: 6e 64 72 6f 2f 6d 79 74 61 62 6c 65 2e 67 65 6f ndro/mytable.geo
33d0: 6a 73 6f 6e 27 2c 20 31 32 29 3b 0d 0a 2d 2d 2d json', 12);..---
33e0: 2d 2d 2d 2d 2d 2d 0d 0a 31 32 33 34 0d 0a 0d 0a ------..1234....
33f0: 53 45 4c 45 43 54 20 45 78 70 6f 72 74 47 65 6f SELECT ExportGeo
3400: 4a 53 4f 4e 32 28 27 6d 79 74 61 62 6c 65 27 2c JSON2('mytable',
3410: 20 27 67 65 6f 6d 27 2c 20 27 2f 68 6f 6d 65 2f 'geom', '/home/
3420: 73 61 6e 64 72 6f 2f 6d 79 74 61 62 6c 65 2e 67 sandro/mytable.g
3430: 65 6f 6a 73 6f 6e 27 2c 20 31 32 2c 20 31 29 3b eojson', 12, 1);
3440: 0d 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d 0d 0a 31 32 33 ..---------..123
3450: 34 0d 0a 0d 0a 53 45 4c 45 43 54 20 45 78 70 6f 4....SELECT Expo
3460: 72 74 47 65 6f 4a 53 4f 4e 32 28 27 6d 79 74 61 rtGeoJSON2('myta
3470: 62 6c 65 27 2c 20 27 67 65 6f 6d 27 2c 20 27 2f ble', 'geom', '/
3480: 68 6f 6d 65 2f 73 61 6e 64 72 6f 2f 6d 79 74 61 home/sandro/myta
3490: 62 6c 65 2e 67 65 6f 6a 73 6f 6e 27 2c 20 31 32 ble.geojson', 12
34a0: 2c 20 31 2c 20 30 29 3b 0d 0a 2d 2d 2d 2d 2d 2d , 1, 0);..------
34b0: 2d 2d 2d 0d 0a 31 32 33 34 0d 0a 0d 0a 53 45 4c ---..1234....SEL
34c0: 45 43 54 20 45 78 70 6f 72 74 47 65 6f 4a 53 4f ECT ExportGeoJSO
34d0: 4e 32 28 27 6d 79 74 61 62 6c 65 27 2c 20 27 67 N2('mytable', 'g
34e0: 65 6f 6d 27 2c 20 27 2f 68 6f 6d 65 2f 73 61 6e eom', '/home/san
34f0: 64 72 6f 2f 6d 79 74 61 62 6c 65 2e 67 65 6f 6a dro/mytable.geoj
3500: 73 6f 6e 27 2c 20 31 32 2c 20 31 2c 20 30 2c 20 son', 12, 1, 0,
3510: 31 29 3b 0d 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d 0d 0a 1);..---------..
3520: 31 32 33 34 0d 0a 0d 0a 53 45 4c 45 43 54 20 45 1234....SELECT E
3530: 78 70 6f 72 74 47 65 6f 4a 53 4f 4e 32 28 27 6d xportGeoJSON2('m
3540: 79 74 61 62 6c 65 27 2c 20 27 67 65 6f 6d 27 2c ytable', 'geom',
3550: 20 27 2f 68 6f 6d 65 2f 73 61 6e 64 72 6f 2f 6d '/home/sandro/m
3560: 79 74 61 62 6c 65 2e 67 65 6f 6a 73 6f 6e 27 2c ytable.geojson',
3570: 20 31 32 2c 20 31 2c 20 30 2c 20 31 2c 20 27 4c 12, 1, 0, 1, 'L
3580: 4f 57 45 52 43 41 53 45 27 29 3b 0d 0a 2d 2d 2d OWERCASE');..---
3590: 2d 2d 2d 2d 2d 2d 0d 0a 31 32 33 34 0d 0a 3c 2f ------..1234..</
35a0: 76 65 72 62 61 74 69 6d 3e 0d 0a 54 68 65 20 53 verbatim>..The S
35b0: 51 4c 20 66 75 6e 63 74 69 6f 6e 20 3c 62 3e 45 QL function <b>E
35c0: 78 70 6f 72 74 47 65 6f 4a 53 4f 4e 32 28 29 3c xportGeoJSON2()<
35d0: 2f 62 3e 20 63 61 6e 20 64 69 72 65 63 74 6c 79 /b> can directly
35e0: 20 65 78 70 6f 72 74 20 61 20 77 68 6f 6c 65 20 export a whole
35f0: 53 70 61 74 69 61 6c 20 54 61 62 6c 65 20 28 61 Spatial Table (a
3600: 6b 61 20 3c 69 3e 4c 61 79 65 72 3c 2f 69 3e 29 ka <i>Layer</i>)
3610: 20 69 6e 74 6f 20 61 6e 20 65 78 74 65 6e 61 6c into an extenal
3620: 20 47 65 6f 4a 53 4f 4e 20 66 69 6c 65 20 63 6f GeoJSON file co
3630: 6e 66 6f 72 6d 61 74 20 74 6f 20 52 46 43 20 37 nformat to RFC 7
3640: 39 34 36 2e 3c 62 72 3e 0d 0a 54 68 69 73 20 66 946.<br>..This f
3650: 75 6e 63 74 69 6f 6e 20 61 63 63 65 70 74 73 20 unction accepts
3660: 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 61 72 the following ar
3670: 67 75 6d 65 6e 74 73 3a 0d 0a 3c 6f 6c 3e 0d 0a guments:..<ol>..
3680: 3c 6c 69 3e 3c 62 3e 74 61 62 6c 65 3c 2f 62 3e <li><b>table</b>
3690: 3a 20 28 3c 69 3e 6d 61 6e 64 61 74 6f 72 79 3c : (<i>mandatory<
36a0: 2f 69 3e 29 20 6e 61 6d 65 20 6f 66 20 74 68 65 /i>) name of the
36b0: 20 53 70 61 74 69 61 6c 20 54 61 62 6c 65 20 74 Spatial Table t
36c0: 6f 20 62 65 20 65 78 70 6f 72 74 65 64 2e 3c 2f o be exported.</
36d0: 6c 69 3e 0d 0a 3c 6c 69 3e 3c 62 3e 67 65 6f 6d li>..<li><b>geom
36e0: 5f 63 6f 6c 75 6d 6e 3c 2f 62 3e 3a 20 28 3c 69 _column</b>: (<i
36f0: 3e 6d 61 6e 64 61 74 6f 72 79 3c 2f 69 3e 29 20 >mandatory</i>)
3700: 6e 61 6d 65 20 6f 66 20 74 68 65 20 43 6f 6c 75 name of the Colu
3710: 6d 6e 20 63 6f 6e 74 61 69 6e 69 6e 67 20 74 68 mn containing th
3720: 65 20 47 65 6f 6d 65 74 72 69 65 73 20 74 6f 20 e Geometries to
3730: 62 65 20 65 78 70 6f 72 74 65 64 2e 3c 62 72 3e be exported.<br>
3740: 0d 0a 43 61 6e 20 62 65 20 3c 62 3e 4e 55 4c 4c ..Can be <b>NULL
3750: 3c 2f 62 3e 2c 20 61 6e 64 20 69 6e 20 74 68 69 </b>, and in thi
3760: 73 20 63 61 73 65 20 74 68 65 20 66 75 6e 63 74 s case the funct
3770: 69 6f 6e 20 77 69 6c 6c 20 61 75 74 6f 6d 61 74 ion will automat
3780: 69 63 61 6c 6c 79 20 64 65 74 65 72 6d 69 6e 65 ically determine
3790: 20 74 68 65 20 61 70 70 72 6f 70 72 69 61 74 65 the appropriate
37a0: 20 43 6f 6c 75 6d 6e 2d 6e 61 6d 65 20 69 66 20 Column-name if
37b0: 74 68 65 20 54 61 62 6c 65 20 6a 75 73 74 20 63 the Table just c
37c0: 6f 6e 74 61 69 6e 73 20 61 20 73 69 6e 67 6c 65 ontains a single
37d0: 20 47 65 6f 6d 65 74 72 79 2c 20 6f 74 68 65 72 Geometry, other
37e0: 77 69 73 65 20 61 20 66 61 69 6c 75 72 65 20 77 wise a failure w
37f0: 69 6c 6c 20 66 6f 6c 6c 6f 77 2e 3c 2f 6c 69 3e ill follow.</li>
3800: 0d 0a 3c 6c 69 3e 3c 62 3e 66 69 6c 65 6e 61 6d ..<li><b>filenam
3810: 65 3c 2f 62 3e 3a 20 28 3c 69 3e 6d 61 6e 64 61 e</b>: (<i>manda
3820: 74 6f 72 79 3c 2f 69 3e 29 20 61 62 73 6f 6c 75 tory</i>) absolu
3830: 74 65 20 6f 72 20 72 65 6c 61 74 69 76 65 20 70 te or relative p
3840: 61 74 68 20 6f 66 20 74 68 65 20 47 65 6f 4a 73 ath of the GeoJs
3850: 6f 6e 20 66 69 6c 65 20 74 6f 20 62 65 20 63 72 on file to be cr
3860: 65 61 74 65 64 20 28 3c 69 3e 6f 75 74 70 75 74 eated (<i>output
3870: 20 66 69 6c 65 3c 2f 69 3e 29 2e 3c 2f 6c 69 3e file</i>).</li>
3880: 0d 0a 3c 6c 69 3e 3c 62 3e 70 72 65 63 69 73 69 ..<li><b>precisi
3890: 6f 6e 3c 2f 62 3e 3a 20 28 3c 69 3e 6f 70 74 69 on</b>: (<i>opti
38a0: 6f 6e 61 6c 3c 2f 69 3e 29 20 6e 75 6d 62 65 72 onal</i>) number
38b0: 20 6f 66 20 64 65 63 69 6d 61 6c 20 64 69 67 69 of decimal digi
38c0: 74 73 20 74 6f 20 62 65 20 75 73 65 64 20 66 6f ts to be used fo
38d0: 72 20 63 6f 6f 72 64 69 6e 61 74 65 20 76 61 6c r coordinate val
38e0: 75 65 73 3b 20 74 68 65 20 64 65 66 61 75 6c 74 ues; the default
38f0: 20 73 65 74 74 69 6e 67 20 69 73 20 3c 62 3e 38 setting is <b>8
3900: 3c 2f 62 3e 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e </b>.</li>..<li>
3910: 3c 62 3e 6c 6f 6e 5f 6c 61 74 3c 2f 62 3e 3a 20 <b>lon_lat</b>:
3920: 28 3c 69 3e 6f 70 74 69 6f 6e 61 6c 3c 2f 69 3e (<i>optional</i>
3930: 29 20 74 68 69 73 20 69 73 20 61 20 62 6f 6f 6c ) this is a bool
3940: 65 61 6e 20 66 6c 61 67 3a 0d 0a 3c 75 6c 3e 0d ean flag:..<ul>.
3950: 0a 3c 6c 69 3e 69 66 20 73 65 74 20 74 6f 20 3c .<li>if set to <
3960: 62 3e 46 41 4c 53 45 3c 2f 62 3e 20 61 6c 6c 20 b>FALSE</b> all
3970: 63 6f 6f 72 64 69 6e 61 74 65 73 20 77 69 6c 6c coordinates will
3980: 20 62 65 20 65 78 70 6f 72 74 65 64 20 65 78 61 be exported exa
3990: 63 74 6c 79 20 61 73 20 74 68 65 79 20 61 72 65 ctly as they are
39a0: 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 69 66 20 73 .</li>..<li>if s
39b0: 65 74 20 74 6f 20 3c 62 3e 54 52 55 45 3c 2f 62 et to <b>TRUE</b
39c0: 3e 20 61 6c 6c 20 63 6f 6f 72 64 69 6e 61 74 65 > all coordinate
39d0: 73 20 77 69 6c 6c 20 62 65 20 61 75 74 6f 6d 61 s will be automa
39e0: 74 69 63 61 6c 6c 79 20 74 72 61 6e 73 66 6f 72 tically transfor
39f0: 6d 65 64 20 28 69 66 20 72 65 71 75 69 72 65 64 med (if required
3a00: 29 20 69 6e 74 6f 20 3c 62 3e 53 52 49 44 3d 34 ) into <b>SRID=4
3a10: 33 32 36 20 57 47 53 20 38 34 3c 2f 62 3e 20 61 326 WGS 84</b> a
3a20: 73 20 72 65 71 75 69 72 65 64 20 62 79 20 52 46 s required by RF
3a30: 43 20 37 39 34 36 2e 3c 62 72 3e 0d 0a 54 68 69 C 7946.<br>..Thi
3a40: 73 20 69 73 20 74 68 65 20 64 65 66 61 75 6c 74 s is the default
3a50: 20 73 65 74 74 69 6e 67 2e 3c 2f 6c 69 3e 0d 0a setting.</li>..
3a60: 3c 2f 75 6c 3e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e </ul></li>..<li>
3a70: 3c 62 3e 4d 5f 63 6f 6f 72 64 73 3c 2f 62 3e 3a <b>M_coords</b>:
3a80: 20 28 3c 69 3e 6f 70 74 69 6f 6e 61 6c 3c 2f 69 (<i>optional</i
3a90: 3e 29 20 74 68 69 73 20 74 6f 6f 20 69 73 20 61 >) this too is a
3aa0: 20 62 6f 6f 6c 65 61 6e 20 66 6c 61 67 3a 0d 0a boolean flag:..
3ab0: 3c 75 6c 3e 0d 0a 3c 6c 69 3e 69 66 20 73 65 74 <ul>..<li>if set
3ac0: 20 74 6f 20 3c 62 3e 46 41 4c 53 45 3c 2f 62 3e to <b>FALSE</b>
3ad0: 20 65 76 65 6e 74 75 61 6c 20 3c 62 3e 4d 2d 76 eventual <b>M-v
3ae0: 61 6c 75 65 73 3c 2f 62 3e 20 77 69 6c 6c 20 62 alues</b> will b
3af0: 65 20 73 69 6d 70 6c 79 20 69 67 6e 6f 72 65 64 e simply ignored
3b00: 2c 20 61 73 20 72 65 71 75 69 72 65 64 20 62 79 , as required by
3b10: 20 52 46 43 20 37 39 34 36 2e 3c 62 72 3e 0d 0a RFC 7946.<br>..
3b20: 54 68 69 73 20 69 73 20 74 68 65 20 64 65 66 61 This is the defa
3b30: 75 6c 74 20 73 65 74 74 69 6e 67 2e 3c 2f 6c 69 ult setting.</li
3b40: 3e 0d 0a 3c 6c 69 3e 69 66 20 73 65 74 20 74 6f >..<li>if set to
3b50: 20 3c 62 3e 54 52 55 45 3c 2f 62 3e 20 65 76 65 <b>TRUE</b> eve
3b60: 6e 74 75 61 6c 20 3c 62 3e 4d 2d 76 61 6c 75 65 ntual <b>M-value
3b70: 73 3c 2f 62 3e 20 77 69 6c 6c 20 62 65 20 65 78 s</b> will be ex
3b80: 70 6f 72 74 65 64 20 69 6e 74 6f 20 74 68 65 20 ported into the
3b90: 47 65 6f 4a 53 4f 4e 20 66 69 6c 65 20 61 73 20 GeoJSON file as
3ba0: 65 78 74 72 61 2d 63 6f 6f 72 64 69 6e 61 74 65 extra-coordinate
3bb0: 73 2e 3c 62 72 3e 0d 0a 3c 75 3e 4e 6f 74 65 3c s.<br>..<u>Note<
3bc0: 2f 75 3e 3a 20 74 68 65 20 72 65 73 75 6c 74 69 /u>: the resulti
3bd0: 6e 67 20 6f 75 74 70 75 74 20 66 69 6c 65 20 63 ng output file c
3be0: 6f 75 6c 64 20 65 61 73 69 6c 79 20 73 75 66 66 ould easily suff
3bf0: 65 72 20 66 72 6f 6d 20 6c 69 6d 69 74 65 64 20 er from limited
3c00: 70 6f 72 74 61 62 69 6c 69 74 79 2e 3c 2f 6c 69 portability.</li
3c10: 3e 0d 0a 3c 2f 75 6c 3e 3c 2f 6c 69 3e 0d 0a 3c >..</ul></li>..<
3c20: 6c 69 3e 3c 62 3e 69 6e 64 65 6e 74 65 64 3c 2f li><b>indented</
3c30: 62 3e 3a 20 28 3c 69 3e 6f 70 74 69 6f 6e 61 6c b>: (<i>optional
3c40: 3c 2f 69 3e 29 20 79 65 74 20 61 6e 6f 74 68 65 </i>) yet anothe
3c50: 72 20 62 6f 6f 6c 65 61 6e 20 66 6c 61 67 3a 0d r boolean flag:.
3c60: 0a 3c 75 6c 3e 0d 0a 3c 6c 69 3e 49 66 20 73 65 .<ul>..<li>If se
3c70: 74 20 74 6f 20 3c 62 3e 54 52 55 45 3c 2f 62 3e t to <b>TRUE</b>
3c80: 20 74 68 65 20 6f 75 74 70 75 74 20 66 69 6c 65 the output file
3c90: 20 77 69 6c 6c 20 62 65 20 70 72 6f 70 65 72 6c will be properl
3ca0: 79 20 69 6e 64 65 6e 74 65 64 20 66 6f 72 20 65 y indented for e
3cb0: 6e 68 61 6e 63 65 64 20 68 75 6d 61 6e 20 72 65 nhanced human re
3cc0: 61 64 69 62 69 6c 69 74 79 2e 3c 62 72 3e 0d 0a adibility.<br>..
3cd0: 54 68 69 73 20 69 73 20 74 68 65 20 64 65 66 61 This is the defa
3ce0: 75 6c 74 20 73 65 74 74 69 6e 67 2e 3c 2f 6c 69 ult setting.</li
3cf0: 3e 0d 0a 3c 6c 69 3e 49 66 20 73 65 74 20 74 6f >..<li>If set to
3d00: 20 3c 62 3e 46 41 4c 53 45 3c 2f 62 3e 20 74 68 <b>FALSE</b> th
3d10: 65 20 6f 75 74 70 75 74 20 66 69 6c 65 20 77 69 e output file wi
3d20: 6c 6c 20 62 65 20 61 6c 6c 20 69 6e 20 61 20 73 ll be all in a s
3d30: 69 6e 67 6c 65 20 6d 6f 6e 6f 6c 69 74 68 69 63 ingle monolithic
3d40: 20 6c 69 6e 65 20 77 69 74 68 6f 75 74 20 62 6c line without bl
3d50: 61 6e 6b 20 73 70 61 63 65 73 20 6f 72 20 6e 65 ank spaces or ne
3d60: 77 6c 69 6e 65 73 20 28 6e 6f 74 69 63 65 61 62 wlines (noticeab
3d70: 6c 79 20 73 6d 61 6c 6c 65 72 29 2e 3c 2f 6c 69 ly smaller).</li
3d80: 3e 0d 0a 3c 2f 75 6c 3e 3c 2f 6c 69 3e 0d 0a 3c >..</ul></li>..<
3d90: 6c 69 3e 3c 62 3e 63 6f 6c 6e 61 6d 65 5f 63 61 li><b>colname_ca
3da0: 73 65 3c 2f 62 3e 3a 20 28 3c 69 3e 6f 70 74 69 se</b>: (<i>opti
3db0: 6f 6e 61 6c 3c 2f 69 3e 29 20 63 61 6e 20 61 73 onal</i>) can as
3dc0: 73 75 6d 65 20 6f 6e 65 20 74 68 65 20 66 6f 6c sume one the fol
3dd0: 6c 6f 77 69 6e 67 20 76 61 6c 75 65 73 3a 0d 0a lowing values:..
3de0: 3c 75 6c 3e 0d 0a 3c 6c 69 3e 3c 62 3e 27 55 50 <ul>..<li><b>'UP
3df0: 50 45 52 27 3c 2f 62 3e 20 6f 72 20 3c 62 3e 27 PER'</b> or <b>'
3e00: 55 50 50 45 52 43 41 53 45 27 3c 2f 62 3e 3a 20 UPPERCASE'</b>:
3e10: 61 6c 6c 20 61 74 74 72 69 62 75 74 65 20 6e 61 all attribute na
3e20: 6d 65 73 20 77 69 6c 6c 20 62 65 20 69 6e 73 65 mes will be inse
3e30: 72 74 65 64 20 69 6e 74 6f 20 74 68 65 20 6f 75 rted into the ou
3e40: 74 70 75 74 20 66 69 6c 65 20 69 6e 20 66 75 6c tput file in ful
3e50: 6c 20 75 70 70 65 72 20 63 61 73 65 2e 3c 2f 6c l upper case.</l
3e60: 69 3e 0d 0a 3c 6c 69 3e 3c 62 3e 27 4c 4f 57 45 i>..<li><b>'LOWE
3e70: 52 27 3c 2f 62 3e 20 6f 72 20 3c 62 3e 27 4c 4f R'</b> or <b>'LO
3e80: 57 45 52 43 41 53 45 27 3c 2f 62 3e 3a 20 61 6c WERCASE'</b>: al
3e90: 6c 20 61 74 74 72 69 62 75 74 65 20 6e 61 6d 65 l attribute name
3ea0: 73 20 77 69 6c 6c 20 62 65 20 69 6e 73 65 72 74 s will be insert
3eb0: 65 64 20 69 6e 74 6f 20 74 68 65 20 6f 75 74 70 ed into the outp
3ec0: 75 74 20 66 69 6c 65 20 69 6e 20 66 75 6c 6c 20 ut file in full
3ed0: 6c 6f 77 65 72 20 63 61 73 65 2e 3c 62 72 3e 0d lower case.<br>.
3ee0: 0a 54 68 69 73 20 69 73 20 74 68 65 20 64 65 66 .This is the def
3ef0: 61 75 6c 74 20 73 65 74 74 69 6e 67 2e 3c 2f 6c ault setting.</l
3f00: 69 3e 0d 0a 3c 6c 69 3e 3c 62 3e 27 53 41 4d 45 i>..<li><b>'SAME
3f10: 27 3c 2f 62 3e 20 6f 72 20 3c 62 3e 27 53 41 4d '</b> or <b>'SAM
3f20: 45 43 41 53 45 27 3c 2f 62 3e 3a 20 61 6c 6c 20 ECASE'</b>: all
3f30: 61 74 74 72 69 62 75 74 65 20 6e 61 6d 65 73 20 attribute names
3f40: 77 69 6c 6c 20 62 65 20 69 6e 73 65 72 74 65 64 will be inserted
3f50: 20 69 6e 74 6f 20 74 68 65 20 6f 75 74 70 75 74 into the output
3f60: 20 66 69 6c 65 20 70 72 65 73 65 72 76 69 6e 67 file preserving
3f70: 20 61 6c 6c 20 75 70 70 65 72 2d 20 61 6e 64 20 all upper- and
3f80: 6c 6f 77 65 72 2d 63 61 73 65 20 6c 65 74 74 65 lower-case lette
3f90: 72 73 20 65 78 61 63 74 6c 79 20 61 73 20 74 68 rs exactly as th
3fa0: 65 79 20 61 72 65 20 64 65 66 69 6e 65 64 20 69 ey are defined i
3fb0: 6e 20 74 68 65 20 63 6f 72 72 65 73 70 6f 6e 64 n the correspond
3fc0: 69 6e 67 20 63 6f 6c 75 6d 6e 20 6e 61 6d 65 73 ing column names
3fd0: 2e 3c 2f 6c 69 3e 0d 0a 3c 2f 75 6c 3e 3c 2f 6c .</li>..</ul></l
3fe0: 69 3e 0d 0a 3c 6c 69 3e 74 68 65 20 3c 62 3e 72 i>..<li>the <b>r
3ff0: 65 74 75 72 6e 20 76 61 6c 75 65 3c 2f 62 3e 20 eturn value</b>
4000: 69 73 20 61 6e 20 3c 62 3e 49 4e 54 45 47 45 52 is an <b>INTEGER
4010: 3c 2f 62 3e 20 63 6f 72 72 65 73 70 6f 6e 64 69 </b> correspondi
4020: 6e 67 20 74 6f 20 74 68 65 20 6e 75 6d 62 65 72 ng to the number
4030: 20 6f 66 20 65 78 70 6f 72 74 65 64 20 72 6f 77 of exported row
4040: 73 2c 20 6f 72 20 3c 62 3e 4e 55 4c 4c 3c 2f 62 s, or <b>NULL</b
4050: 3e 20 69 6e 20 74 68 65 20 63 61 73 65 20 6f 66 > in the case of
4060: 20 66 61 69 6c 75 72 65 20 6f 72 20 69 6e 76 61 failure or inva
4070: 6c 69 64 20 61 72 67 75 6d 65 6e 74 73 2e 3c 2f lid arguments.</
4080: 6c 69 3e 0d 0a 3c 2f 6f 6c 3e 0d 0a 3c 74 61 62 li>..</ol>..<tab
4090: 6c 65 20 63 65 6c 6c 73 70 61 63 69 6e 67 3d 22 le cellspacing="
40a0: 34 22 20 63 65 6c 6c 70 61 64 64 69 6e 67 3d 22 4" cellpadding="
40b0: 38 22 20 62 67 63 6f 6c 6f 72 3d 22 23 66 66 66 8" bgcolor="#fff
40c0: 66 64 30 22 3e 3c 74 72 3e 3c 74 64 3e 0d 0a 3c fd0"><tr><td>..<
40d0: 68 33 3e 43 61 76 65 61 74 3c 2f 68 33 3e 0d 0a h3>Caveat</h3>..
40e0: 41 20 73 69 6d 69 6c 61 72 20 66 75 6e 63 74 69 A similar functi
40f0: 6f 6e 20 6e 61 6d 65 64 20 3c 62 3e 45 78 70 6f on named <b>Expo
4100: 72 74 47 65 6f 4a 53 4f 4e 28 29 3c 2f 62 3e 20 rtGeoJSON()</b>
4110: 77 61 73 20 61 6c 72 65 61 64 79 20 73 75 70 70 was already supp
4120: 6f 72 74 65 64 20 62 79 20 70 72 65 76 69 6f 75 orted by previou
4130: 73 20 76 65 72 73 69 6f 6e 73 20 6f 66 20 53 70 s versions of Sp
4140: 61 74 69 61 4c 69 74 65 2c 20 62 75 74 20 69 74 atiaLite, but it
4150: 20 77 61 73 20 6d 6f 64 65 6c 6c 65 64 20 61 67 was modelled ag
4160: 61 69 6e 73 74 20 74 68 65 20 6f 6c 64 20 28 3c ainst the old (<
4170: 62 3e 70 72 65 2d 52 46 43 3c 2f 62 3e 29 20 47 b>pre-RFC</b>) G
4180: 65 6f 4a 53 4f 4e 20 73 70 65 63 69 66 69 63 61 eoJSON specifica
4190: 74 69 6f 6e 2e 3c 62 72 3e 0d 0a 3c 62 3e 45 78 tion.<br>..<b>Ex
41a0: 70 6f 72 74 47 65 6f 4a 53 4f 4e 28 29 3c 2f 62 portGeoJSON()</b
41b0: 3e 20 69 73 20 6e 6f 77 20 3c 62 3e 44 45 50 52 > is now <b>DEPR
41c0: 45 43 41 54 45 44 3c 2f 62 3e 2c 20 61 6e 64 20 ECATED</b>, and
41d0: 77 69 6c 6c 20 72 65 6d 61 69 6e 20 74 6f 20 61 will remain to a
41e0: 76 6f 69 64 20 62 72 65 61 6b 69 6e 67 20 65 78 void breaking ex
41f0: 69 73 74 69 6e 67 20 61 70 70 6c 69 63 61 74 69 isting applicati
4200: 6f 6e 73 20 61 6e 64 20 73 63 72 69 70 74 73 2e ons and scripts.
4210: 3c 62 72 3e 3c 62 72 3e 0d 0a 49 74 20 69 73 20 <br><br>..It is
4220: 73 74 72 6f 6e 67 6c 79 20 72 65 63 6f 6d 6d 65 strongly recomme
4230: 6e 64 65 64 20 74 6f 20 75 73 65 20 3c 62 3e 45 nded to use <b>E
4240: 78 70 6f 72 74 47 65 6f 4a 53 4f 4e 32 28 29 3c xportGeoJSON2()<
4250: 2f 62 3e 20 66 6f 72 20 61 6e 79 20 6e 65 77 20 /b> for any new
4260: 64 65 76 65 6c 6f 70 6d 65 6e 74 20 61 73 20 66 development as f
4270: 75 6c 6c 20 72 65 70 6c 61 63 65 6d 65 6e 74 20 ull replacement
4280: 63 6f 6e 66 6f 72 6d 61 6e 74 20 74 6f 20 52 46 conformant to RF
4290: 43 20 37 39 34 36 2e 0d 0a 3c 2f 74 64 3e 3c 2f C 7946...</td></
42a0: 74 72 3e 3c 2f 74 61 62 6c 65 3e 0d 0a 3c 62 72 tr></table>..<br
42b0: 3e 0d 0a 3c 74 61 62 6c 65 20 63 65 6c 6c 73 70 >..<table cellsp
42c0: 61 63 69 6e 67 3d 22 34 22 20 63 65 6c 6c 70 61 acing="4" cellpa
42d0: 64 64 69 6e 67 3d 22 38 22 20 62 67 63 6f 6c 6f dding="8" bgcolo
42e0: 72 3d 22 23 66 66 63 30 61 30 22 3e 3c 74 72 3e r="#ffc0a0"><tr>
42f0: 3c 74 64 3e 0d 0a 3c 68 33 3e 57 61 72 6e 69 6e <td>..<h3>Warnin
4300: 67 3c 2f 68 33 3e 0d 0a 54 68 69 73 20 53 51 4c g</h3>..This SQL
4310: 20 66 75 6e 63 74 69 6f 6e 20 6f 70 65 6e 20 74 function open t
4320: 68 65 20 64 6f 6f 72 20 74 6f 20 6d 61 6e 79 20 he door to many
4330: 70 6f 74 65 6e 74 69 61 6c 20 73 65 63 75 72 69 potential securi
4340: 74 79 20 69 73 73 75 65 73 2c 20 61 6e 64 20 74 ty issues, and t
4350: 68 75 73 20 3c 62 3e 3c 69 3e 69 73 20 61 6c 77 hus <b><i>is alw
4360: 61 79 73 20 64 69 73 61 62 6c 65 64 20 62 79 20 ays disabled by
4370: 64 65 66 61 75 6c 74 3c 2f 69 3e 3c 2f 62 3e 2e default</i></b>.
4380: 3c 62 72 3e 0d 0a 45 78 70 6c 69 63 69 74 6c 79 <br>..Explicitly
4390: 20 73 65 74 74 69 6e 67 20 74 68 65 20 65 78 74 setting the ext
43a0: 65 72 6e 61 6c 20 76 61 72 69 61 62 6c 65 20 3c ernal variable <
43b0: 62 3e 53 50 41 54 49 41 4c 49 54 45 5f 53 45 43 b>SPATIALITE_SEC
43c0: 55 52 49 54 59 3d 72 65 6c 61 78 65 64 3c 2f 62 URITY=relaxed</b
43d0: 3e 20 69 73 20 61 62 73 6f 6c 75 74 65 6c 79 20 > is absolutely
43e0: 72 65 71 75 69 72 65 64 20 69 6e 20 6f 72 64 65 required in orde
43f0: 72 20 74 6f 20 65 6e 61 62 6c 65 20 74 68 69 73 r to enable this
4400: 20 66 75 6e 63 74 69 6f 6e 2e 0d 0a 3c 2f 74 64 function...</td
4410: 3e 3c 2f 74 72 3e 3c 2f 74 61 62 6c 65 3e 0d 0a ></tr></table>..
4420: 3c 62 72 3e 0d 0a 3c 68 72 3e 0d 0a 3c 68 33 3e <br>..<hr>..<h3>
4430: 49 6d 70 6f 72 74 69 6e 67 20 64 61 74 61 20 66 Importing data f
4440: 72 6f 6d 20 47 65 6f 4a 53 4f 4e 3c 2f 68 33 3e rom GeoJSON</h3>
4450: 0d 0a 3c 76 65 72 62 61 74 69 6d 3e 0d 0a 53 45 ..<verbatim>..SE
4460: 4c 45 43 54 20 49 6d 70 6f 72 74 47 65 6f 4a 53 LECT ImportGeoJS
4470: 4f 4e 28 27 2f 68 6f 6d 65 2f 73 61 6e 64 72 6f ON('/home/sandro
4480: 2f 73 6f 6d 65 6c 61 79 65 72 2e 67 65 6f 6a 73 /somelayer.geojs
4490: 6f 6e 27 2c 20 27 73 6f 6d 65 6c 61 79 65 72 27 on', 'somelayer'
44a0: 29 3b 0d 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0d );..-----------.
44b0: 0a 39 39 0d 0a 0d 0a 53 45 4c 45 43 54 20 49 6d .99....SELECT Im
44c0: 70 6f 72 74 47 65 6f 4a 53 4f 4e 28 27 2f 68 6f portGeoJSON('/ho
44d0: 6d 65 2f 73 61 6e 64 72 6f 2f 73 6f 6d 65 6c 61 me/sandro/somela
44e0: 79 65 72 2e 67 65 6f 6a 73 6f 6e 27 2c 20 27 73 yer.geojson', 's
44f0: 6f 6d 65 6c 61 79 65 72 27 2c 20 27 67 65 6f 6d omelayer', 'geom
4500: 27 29 3b 0d 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ');..-----------
4510: 0d 0a 39 39 0d 0a 0d 0a 53 45 4c 45 43 54 20 49 ..99....SELECT I
4520: 6d 70 6f 72 74 47 65 6f 4a 53 4f 4e 28 27 2f 68 mportGeoJSON('/h
4530: 6f 6d 65 2f 73 61 6e 64 72 6f 2f 73 6f 6d 65 6c ome/sandro/somel
4540: 61 79 65 72 2e 67 65 6f 6a 73 6f 6e 27 2c 20 27 ayer.geojson', '
4550: 73 6f 6d 65 6c 61 79 65 72 27 2c 20 27 67 65 6f somelayer', 'geo
4560: 6d 27 2c 20 31 29 3b 0d 0a 2d 2d 2d 2d 2d 2d 2d m', 1);..-------
4570: 2d 2d 2d 2d 0d 0a 39 39 0d 0a 0d 0a 53 45 4c 45 ----..99....SELE
4580: 43 54 20 49 6d 70 6f 72 74 47 65 6f 4a 53 4f 4e CT ImportGeoJSON
4590: 28 27 2f 68 6f 6d 65 2f 73 61 6e 64 72 6f 2f 73 ('/home/sandro/s
45a0: 6f 6d 65 6c 61 79 65 72 2e 67 65 6f 6a 73 6f 6e omelayer.geojson
45b0: 27 2c 20 27 73 6f 6d 65 6c 61 79 65 72 27 2c 20 ', 'somelayer',
45c0: 27 67 65 6f 6d 27 2c 20 31 2c 20 33 30 30 33 29 'geom', 1, 3003)
45d0: 3b 0d 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0d 0a ;..-----------..
45e0: 39 39 0d 0a 0d 0a 53 45 4c 45 43 54 20 49 6d 70 99....SELECT Imp
45f0: 6f 72 74 47 65 6f 4a 53 4f 4e 28 27 2f 68 6f 6d ortGeoJSON('/hom
4600: 65 2f 73 61 6e 64 72 6f 2f 73 6f 6d 65 6c 61 79 e/sandro/somelay
4610: 65 72 2e 67 65 6f 6a 73 6f 6e 27 2c 20 27 73 6f er.geojson', 'so
4620: 6d 65 6c 61 79 65 72 27 2c 20 27 67 65 6f 6d 27 melayer', 'geom'
4630: 2c 20 31 2c 20 33 30 30 33 2c 20 27 4c 4f 57 45 , 1, 3003, 'LOWE
4640: 52 43 41 53 45 27 29 3b 0d 0a 2d 2d 2d 2d 2d 2d RCASE');..------
4650: 2d 2d 2d 2d 2d 0d 0a 39 39 0d 0a 3c 2f 76 65 72 -----..99..</ver
4660: 62 61 74 69 6d 3e 0d 0a 54 68 65 20 53 51 4c 20 batim>..The SQL
4670: 66 75 6e 63 74 69 6f 6e 20 3c 62 3e 49 6d 70 6f function <b>Impo
4680: 72 74 47 65 6f 4a 53 4f 4e 28 29 3c 2f 62 3e 20 rtGeoJSON()</b>
4690: 63 61 6e 20 64 69 72 65 63 74 6c 79 20 63 72 65 can directly cre
46a0: 61 74 65 20 61 20 6e 65 77 20 53 70 61 74 69 61 ate a new Spatia
46b0: 6c 20 54 61 62 6c 65 20 62 79 20 69 6d 70 6f 72 l Table by impor
46c0: 74 69 6e 67 20 64 61 74 61 20 66 72 6f 6d 20 61 ting data from a
46d0: 6e 20 65 78 74 65 6e 61 6c 20 47 65 6f 4a 53 4f n extenal GeoJSO
46e0: 4e 20 66 69 6c 65 20 63 6f 6e 66 6f 72 6d 61 74 N file conformat
46f0: 20 74 6f 20 52 46 43 20 37 39 34 36 2e 3c 62 72 to RFC 7946.<br
4700: 3e 0d 0a 54 68 69 73 20 66 75 6e 63 74 69 6f 6e >..This function
4710: 20 61 63 63 65 70 74 73 20 74 68 65 20 66 6f 6c accepts the fol
4720: 6c 6f 77 69 6e 67 20 61 72 67 75 6d 65 6e 74 73 lowing arguments
4730: 3a 0d 0a 3c 6f 6c 3e 0d 0a 3c 6c 69 3e 3c 62 3e :..<ol>..<li><b>
4740: 66 69 6c 65 6e 61 6d 65 3c 2f 62 3e 3a 20 28 3c filename</b>: (<
4750: 69 3e 6d 61 6e 64 61 74 6f 72 79 3c 2f 69 3e 29 i>mandatory</i>)
4760: 20 61 62 73 6f 6c 75 74 65 20 6f 72 20 72 65 6c absolute or rel
4770: 61 74 69 76 65 20 70 61 74 68 20 6f 66 20 74 68 ative path of th
4780: 65 20 47 65 6f 4a 73 6f 6e 20 66 69 6c 65 20 74 e GeoJson file t
4790: 6f 20 62 65 20 69 6d 70 6f 72 74 65 64 20 28 3c o be imported (<
47a0: 69 3e 69 6e 70 75 74 20 66 69 6c 65 3c 2f 69 3e i>input file</i>
47b0: 29 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 3c 62 3e ).</li>..<li><b>
47c0: 74 61 62 6c 65 3c 2f 62 3e 3a 20 28 3c 69 3e 6d table</b>: (<i>m
47d0: 61 6e 64 61 74 6f 72 79 3c 2f 69 3e 29 20 6e 61 andatory</i>) na
47e0: 6d 65 20 6f 66 20 74 68 65 20 53 70 61 74 69 61 me of the Spatia
47f0: 6c 20 54 61 62 6c 65 20 74 6f 20 62 65 20 63 72 l Table to be cr
4800: 65 61 74 65 64 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 eated.</li>..<li
4810: 3e 3c 62 3e 67 65 6f 6d 5f 63 6f 6c 75 6d 6e 3c ><b>geom_column<
4820: 2f 62 3e 3a 20 28 3c 69 3e 6f 70 74 69 6f 6e 61 /b>: (<i>optiona
4830: 6c 3c 2f 69 3e 29 20 6e 61 6d 65 20 6f 66 20 74 l</i>) name of t
4840: 68 65 20 47 65 6f 6d 65 74 72 79 20 43 6f 6c 75 he Geometry Colu
4850: 6d 6e 20 74 6f 20 62 65 20 63 72 65 61 74 65 64 mn to be created
4860: 2e 3c 62 72 3e 0d 0a 49 66 20 6e 6f 74 20 65 78 .<br>..If not ex
4870: 70 6c 69 63 69 74 6c 79 20 73 70 65 63 69 66 69 plicitly specifi
4880: 65 64 20 6f 72 20 3c 62 3e 4e 55 4c 4c 3c 2f 62 ed or <b>NULL</b
4890: 3e 20 61 20 63 6f 6c 75 6d 6e 20 6e 61 6d 65 64 > a column named
48a0: 20 3c 62 3e 27 67 65 6f 6d 65 74 72 79 27 3c 2f <b>'geometry'</
48b0: 62 3e 20 77 69 6c 6c 20 62 65 20 63 72 65 61 74 b> will be creat
48c0: 65 64 20 62 79 20 64 65 66 61 75 6c 74 2e 3c 2f ed by default.</
48d0: 6c 69 3e 0d 0a 3c 6c 69 3e 3c 62 3e 73 70 61 74 li>..<li><b>spat
48e0: 69 61 6c 5f 69 6e 64 65 78 3c 2f 62 3e 3a 20 28 ial_index</b>: (
48f0: 3c 69 3e 6f 70 74 69 6f 6e 61 6c 3c 2f 69 3e 29 <i>optional</i>)
4900: 20 74 68 69 73 20 69 73 20 61 20 62 6f 6f 6c 65 this is a boole
4910: 61 6e 20 66 6c 61 67 3a 0d 0a 3c 75 6c 3e 0d 0a an flag:..<ul>..
4920: 3c 6c 69 3e 69 66 20 73 65 74 20 74 6f 20 3c 62 <li>if set to <b
4930: 3e 54 52 55 45 3c 2f 62 3e 20 61 20 3c 62 3e 53 >TRUE</b> a <b>S
4940: 70 61 74 69 61 6c 49 6e 64 65 78 3c 2f 62 3e 20 patialIndex</b>
4950: 73 75 70 70 6f 72 74 69 6e 67 20 74 68 65 20 47 supporting the G
4960: 65 6f 6d 65 74 72 79 20 43 6f 6c 75 6d 6e 20 77 eometry Column w
4970: 69 6c 6c 20 62 65 20 61 75 74 6f 6d 61 74 69 63 ill be automatic
4980: 61 6c 6c 79 20 63 72 65 61 74 65 64 2e 3c 2f 6c ally created.</l
4990: 69 3e 0d 0a 3c 6c 69 3e 69 66 20 73 65 74 20 74 i>..<li>if set t
49a0: 6f 20 3c 62 3e 46 41 4c 53 45 3c 2f 62 3e 20 6e o <b>FALSE</b> n
49b0: 6f 20 53 70 61 74 69 61 6c 49 6e 64 65 78 20 77 o SpatialIndex w
49c0: 69 6c 6c 20 62 65 20 63 72 65 61 74 65 64 2e 3c ill be created.<
49d0: 62 72 3e 0d 0a 54 68 69 73 20 69 73 20 74 68 65 br>..This is the
49e0: 20 64 65 66 61 75 6c 74 20 73 65 74 74 69 6e 67 default setting
49f0: 2e 3c 2f 6c 69 3e 0d 0a 3c 2f 75 6c 3e 3c 2f 6c .</li>..</ul></l
4a00: 69 3e 0d 0a 3c 6c 69 3e 3c 62 3e 73 72 69 64 3c i>..<li><b>srid<
4a10: 2f 62 3e 3a 20 28 3c 69 3e 6f 70 74 69 6f 6e 61 /b>: (<i>optiona
4a20: 6c 3c 2f 69 3e 29 3a 0d 0a 3c 75 6c 3e 0d 0a 3c l</i>):..<ul>..<
4a30: 6c 69 3e 57 68 65 6e 20 69 74 27 73 20 61 20 3c li>When it's a <
4a40: 62 3e 70 6f 73 69 74 69 76 65 20 69 6e 74 65 67 b>positive integ
4a50: 65 72 3c 2f 62 3e 20 69 74 20 63 6f 72 72 65 73 er</b> it corres
4a60: 70 6f 6e 64 73 20 74 6f 20 74 68 65 20 53 52 49 ponds to the SRI
4a70: 44 20 76 61 6c 75 65 20 74 6f 20 62 65 20 61 73 D value to be as
4a80: 73 69 67 6e 65 64 20 74 6f 20 61 6c 6c 20 69 6d signed to all im
4a90: 70 6f 72 74 65 64 20 47 65 6f 6d 65 74 72 69 65 ported Geometrie
4aa0: 73 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 49 66 20 s.</li>..<li>If
4ab0: 3c 62 3e 30 3c 2f 62 3e 20 6f 72 20 3c 62 3e 6e <b>0</b> or <b>n
4ac0: 65 67 61 74 69 76 65 3c 2f 62 3e 20 61 6c 6c 20 egative</b> all
4ad0: 69 6d 70 6f 72 74 65 64 20 47 65 6f 6d 65 74 72 imported Geometr
4ae0: 69 65 73 20 77 69 6c 6c 20 62 65 20 61 73 73 75 ies will be assu
4af0: 6d 65 64 20 74 6f 20 62 65 20 69 6e 20 3c 62 3e med to be in <b>
4b00: 53 52 49 44 3d 34 33 32 36 20 57 47 53 20 38 34 SRID=4326 WGS 84
4b10: 3c 2f 62 3e 20 28 3c 69 3e 67 65 6f 67 72 61 70 </b> (<i>geograp
4b20: 68 69 63 20 63 6f 6f 72 64 69 6e 61 74 65 73 20 hic coordinates
4b30: 65 78 70 72 65 73 73 65 64 20 61 73 20 3c 62 3e expressed as <b>
4b40: 4c 6f 6e 67 69 74 75 64 65 73 3c 2f 62 3e 20 61 Longitudes</b> a
4b50: 6e 64 20 3c 62 3e 4c 61 74 69 74 75 64 65 73 3c nd <b>Latitudes<
4b60: 2f 62 3e 3c 2f 69 3e 29 20 61 73 20 72 65 71 75 /b></i>) as requ
4b70: 69 72 65 64 20 62 79 20 52 46 43 20 37 39 34 36 ired by RFC 7946
4b80: 2e 3c 62 72 3e 0d 0a 54 68 69 73 20 69 73 20 74 .<br>..This is t
4b90: 68 65 20 64 65 66 61 75 6c 74 20 73 65 74 74 69 he default setti
4ba0: 6e 67 2e 3c 2f 6c 69 3e 0d 0a 3c 2f 75 6c 3e 3c ng.</li>..</ul><
4bb0: 2f 6c 69 3e 0d 0a 3c 6c 69 3e 3c 62 3e 63 6f 6c /li>..<li><b>col
4bc0: 6e 61 6d 65 5f 63 61 73 65 3c 2f 62 3e 3a 20 28 name_case</b>: (
4bd0: 3c 69 3e 6f 70 74 69 6f 6e 61 6c 3c 2f 69 3e 29 <i>optional</i>)
4be0: 20 63 61 6e 20 61 73 73 75 6d 65 20 6f 6e 65 20 can assume one
4bf0: 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 76 61 the following va
4c00: 6c 75 65 73 3a 0d 0a 3c 75 6c 3e 0d 0a 3c 6c 69 lues:..<ul>..<li
4c10: 3e 3c 62 3e 27 55 50 50 45 52 27 3c 2f 62 3e 20 ><b>'UPPER'</b>
4c20: 6f 72 20 3c 62 3e 27 55 50 50 45 52 43 41 53 45 or <b>'UPPERCASE
4c30: 27 3c 2f 62 3e 3a 20 61 6c 6c 20 63 6f 6c 75 6d '</b>: all colum
4c40: 6e 73 20 77 69 6c 6c 20 62 65 20 63 72 65 61 74 ns will be creat
4c50: 65 64 20 69 6e 74 6f 20 74 68 65 20 74 61 62 6c ed into the tabl
4c60: 65 20 69 6e 20 66 75 6c 6c 20 75 70 70 65 72 20 e in full upper
4c70: 63 61 73 65 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e case.</li>..<li>
4c80: 3c 62 3e 27 4c 4f 57 45 52 27 3c 2f 62 3e 20 6f <b>'LOWER'</b> o
4c90: 72 20 3c 62 3e 27 4c 4f 57 45 52 43 41 53 45 27 r <b>'LOWERCASE'
4ca0: 3c 2f 62 3e 3a 20 61 6c 6c 20 63 6f 6c 75 6d 6e </b>: all column
4cb0: 73 20 77 69 6c 6c 20 62 65 20 63 72 65 61 74 65 s will be create
4cc0: 64 20 69 6e 74 6f 20 74 68 65 20 74 61 62 6c 65 d into the table
4cd0: 20 69 6e 20 66 75 6c 6c 20 6c 6f 77 65 72 20 63 in full lower c
4ce0: 61 73 65 2e 3c 62 72 3e 0d 0a 54 68 69 73 20 69 ase.<br>..This i
4cf0: 73 20 74 68 65 20 64 65 66 61 75 6c 74 20 73 65 s the default se
4d00: 74 74 69 6e 67 2e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 tting.</li>..<li
4d10: 3e 3c 62 3e 27 53 41 4d 45 27 3c 2f 62 3e 20 6f ><b>'SAME'</b> o
4d20: 72 20 3c 62 3e 27 53 41 4d 45 43 41 53 45 27 3c r <b>'SAMECASE'<
4d30: 2f 62 3e 3a 20 61 6c 6c 20 63 6f 6c 75 6d 6e 73 /b>: all columns
4d40: 20 77 69 6c 6c 20 62 65 20 63 72 65 61 74 65 64 will be created
4d50: 20 69 6e 74 6f 20 74 68 65 20 74 61 62 6c 65 20 into the table
4d60: 70 72 65 73 65 72 76 69 6e 67 20 61 6c 6c 20 75 preserving all u
4d70: 70 70 65 72 2d 20 61 6e 64 20 6c 6f 77 65 72 2d pper- and lower-
4d80: 63 61 73 65 20 6c 65 74 74 65 72 73 20 65 78 61 case letters exa
4d90: 63 74 6c 79 20 61 73 20 74 68 65 79 20 61 72 65 ctly as they are
4da0: 20 64 65 66 69 6e 65 64 20 69 6e 20 74 68 65 20 defined in the
4db0: 63 6f 72 72 65 73 70 6f 6e 64 69 6e 67 20 47 65 corresponding Ge
4dc0: 6f 4a 53 4f 4e 20 61 74 74 72 69 62 75 74 65 20 oJSON attribute
4dd0: 6e 61 6d 65 73 2e 3c 2f 6c 69 3e 0d 0a 3c 2f 75 names.</li>..</u
4de0: 6c 3e 3c 2f 6c 69 3e 0d 0a 3c 6c 69 3e 74 68 65 l></li>..<li>the
4df0: 20 3c 62 3e 72 65 74 75 72 6e 20 76 61 6c 75 65 <b>return value
4e00: 3c 2f 62 3e 20 69 73 20 61 6e 20 3c 62 3e 49 4e </b> is an <b>IN
4e10: 54 45 47 45 52 3c 2f 62 3e 20 63 6f 72 72 65 73 TEGER</b> corres
4e20: 70 6f 6e 64 69 6e 67 20 74 6f 20 74 68 65 20 6e ponding to the n
4e30: 75 6d 62 65 72 20 6f 66 20 65 78 70 6f 72 74 65 umber of exporte
4e40: 64 20 72 6f 77 73 2c 20 6f 72 20 3c 62 3e 4e 55 d rows, or <b>NU
4e50: 4c 4c 3c 2f 62 3e 20 69 6e 20 74 68 65 20 63 61 LL</b> in the ca
4e60: 73 65 20 6f 66 20 66 61 69 6c 75 72 65 20 6f 72 se of failure or
4e70: 20 69 6e 76 61 6c 69 64 20 61 72 67 75 6d 65 6e invalid argumen
4e80: 74 73 2e 3c 2f 6c 69 3e 0d 0a 3c 2f 6f 6c 3e 0d ts.</li>..</ol>.
4e90: 0a 3c 74 61 62 6c 65 20 63 65 6c 6c 73 70 61 63 .<table cellspac
4ea0: 69 6e 67 3d 22 34 22 20 63 65 6c 6c 70 61 64 64 ing="4" cellpadd
4eb0: 69 6e 67 3d 22 38 22 20 62 67 63 6f 6c 6f 72 3d ing="8" bgcolor=
4ec0: 22 23 66 66 63 30 61 30 22 3e 3c 74 72 3e 3c 74 "#ffc0a0"><tr><t
4ed0: 64 3e 0d 0a 3c 68 33 3e 57 61 72 6e 69 6e 67 3c d>..<h3>Warning<
4ee0: 2f 68 33 3e 0d 0a 54 68 69 73 20 53 51 4c 20 66 /h3>..This SQL f
4ef0: 75 6e 63 74 69 6f 6e 20 6f 70 65 6e 20 74 68 65 unction open the
4f00: 20 64 6f 6f 72 20 74 6f 20 6d 61 6e 79 20 70 6f door to many po
4f10: 74 65 6e 74 69 61 6c 20 73 65 63 75 72 69 74 79 tential security
4f20: 20 69 73 73 75 65 73 2c 20 61 6e 64 20 74 68 75 issues, and thu
4f30: 73 20 3c 62 3e 3c 69 3e 69 73 20 61 6c 77 61 79 s <b><i>is alway
4f40: 73 20 64 69 73 61 62 6c 65 64 20 62 79 20 64 65 s disabled by de
4f50: 66 61 75 6c 74 3c 2f 69 3e 3c 2f 62 3e 2e 3c 62 fault</i></b>.<b
4f60: 72 3e 0d 0a 45 78 70 6c 69 63 69 74 6c 79 20 73 r>..Explicitly s
4f70: 65 74 74 69 6e 67 20 74 68 65 20 65 78 74 65 72 etting the exter
4f80: 6e 61 6c 20 76 61 72 69 61 62 6c 65 20 3c 62 3e nal variable <b>
4f90: 53 50 41 54 49 41 4c 49 54 45 5f 53 45 43 55 52 SPATIALITE_SECUR
4fa0: 49 54 59 3d 72 65 6c 61 78 65 64 3c 2f 62 3e 20 ITY=relaxed</b>
4fb0: 69 73 20 61 62 73 6f 6c 75 74 65 6c 79 20 72 65 is absolutely re
4fc0: 71 75 69 72 65 64 20 69 6e 20 6f 72 64 65 72 20 quired in order
4fd0: 74 6f 20 65 6e 61 62 6c 65 20 74 68 69 73 20 66 to enable this f
4fe0: 75 6e 63 74 69 6f 6e 2e 0d 0a 3c 2f 74 64 3e 3c unction...</td><
4ff0: 2f 74 72 3e 3c 2f 74 61 62 6c 65 3e 0d 0a 3c 62 /tr></table>..<b
5000: 72 3e 0d 0a 3c 68 72 3e 0d 0a 3c 68 33 3e 56 69 r>..<hr>..<h3>Vi
5010: 72 74 75 61 6c 47 65 6f 4a 53 4f 4e 3c 2f 68 33 rtualGeoJSON</h3
5020: 3e 0d 0a 3c 76 65 72 62 61 74 69 6d 3e 0d 0a 43 >..<verbatim>..C
5030: 52 45 41 54 45 20 56 49 52 54 55 41 4c 20 54 41 REATE VIRTUAL TA
5040: 42 4c 45 20 73 6f 6d 65 5f 6e 61 6d 65 20 55 53 BLE some_name US
5050: 49 4e 47 20 56 69 72 74 75 61 6c 47 65 6f 4a 53 ING VirtualGeoJS
5060: 4f 4e 28 20 70 61 74 68 2c 20 5b 20 73 72 69 64 ON( path, [ srid
5070: 20 2c 20 5b 20 63 6f 6c 6e 61 6d 65 5f 63 61 73 , [ colname_cas
5080: 65 20 5d 5d 20 29 3b 0d 0a 3c 2f 76 65 72 62 61 e ]] );..</verba
5090: 74 69 6d 3e 0d 0a 41 20 3c 62 3e 56 69 72 74 75 tim>..A <b>Virtu
50a0: 61 6c 47 65 6f 4a 53 4f 4e 3c 2f 62 3e 20 74 61 alGeoJSON</b> ta
50b0: 62 6c 65 20 69 73 20 73 74 72 69 63 74 6c 79 20 ble is strictly
50c0: 73 69 6d 69 6c 61 72 20 74 6f 20 61 20 3c 62 3e similar to a <b>
50d0: 56 69 72 74 75 61 6c 53 68 61 70 65 3c 2f 62 3e VirtualShape</b>
50e0: 20 74 61 62 6c 65 2c 20 74 68 65 20 6f 6e 6c 79 table, the only
50f0: 20 64 69 66 66 65 72 65 6e 63 65 20 62 65 74 77 difference betw
5100: 65 65 6e 20 74 68 65 6d 20 62 65 69 6e 67 20 74 een them being t
5110: 68 65 20 66 69 6c 65 20 66 6f 72 6d 61 74 20 6f he file format o
5120: 66 20 74 68 65 20 75 6e 64 65 72 6c 61 79 69 6e f the underlayin
5130: 67 20 64 61 74 61 73 6f 75 72 63 65 2e 3c 62 72 g datasource.<br
5140: 3e 0d 0a 45 78 63 65 70 74 20 66 6f 72 20 74 68 >..Except for th
5150: 69 73 20 73 6d 61 6c 6c 20 62 75 74 20 66 75 6e is small but fun
5160: 64 61 6d 65 6e 74 61 6c 20 64 65 74 61 69 6c 20 damental detail
5170: 62 6f 74 68 20 74 68 65 6d 20 62 65 68 61 76 65 both them behave
5180: 20 69 6e 20 65 78 61 63 74 6c 79 20 74 68 65 20 in exactly the
5190: 73 61 6d 65 20 77 61 79 2e 0d 0a 3c 62 72 3e 0d same way...<br>.
51a0: 0a 3c 75 6c 3e 0d 0a 3c 6c 69 3e 4a 75 73 74 20 .<ul>..<li>Just
51b0: 61 20 73 69 6e 67 6c 65 20 6d 61 6e 64 61 74 6f a single mandato
51c0: 72 79 20 61 72 67 75 6d 65 6e 74 20 69 73 20 72 ry argument is r
51d0: 65 71 75 69 72 65 64 20 66 6f 72 20 63 72 65 61 equired for crea
51e0: 74 69 6e 67 20 61 20 56 69 72 74 75 61 6c 47 65 ting a VirtualGe
51f0: 6f 4a 53 4f 4e 20 74 61 62 6c 65 3b 20 79 6f 75 oJSON table; you
5200: 20 61 72 65 20 72 65 71 75 69 72 65 64 20 74 6f are required to
5210: 20 73 70 65 63 69 66 79 20 74 68 65 20 3c 62 3e specify the <b>
5220: 61 62 73 6f 6c 75 74 65 3c 2f 62 3e 20 6f 72 20 absolute</b> or
5230: 3c 62 3e 72 65 6c 61 74 69 76 65 20 70 61 74 68 <b>relative path
5240: 3c 2f 62 3e 20 6c 65 61 64 69 6e 67 20 74 6f 20 </b> leading to
5250: 74 68 65 20 65 78 74 65 72 6e 61 6c 20 47 65 6f the external Geo
5260: 4a 53 4f 4e 20 66 69 6c 65 20 6f 6e 20 74 68 65 JSON file on the
5270: 20 66 69 6c 65 73 79 73 74 65 6d 2e 3c 2f 6c 69 filesystem.</li
5280: 3e 0d 0a 3c 6c 69 3e 59 6f 75 20 63 61 6e 20 65 >..<li>You can e
5290: 78 70 6c 69 63 69 74 6c 79 20 73 70 65 63 69 66 xplicitly specif
52a0: 79 20 74 68 65 20 6f 70 74 69 6f 6e 61 6c 20 61 y the optional a
52b0: 72 67 75 6d 65 6e 74 20 3c 62 3e 73 72 69 64 3c rgument <b>srid<
52c0: 2f 62 3e 20 66 6f 72 20 6f 75 74 2d 6f 66 2d 74 /b> for out-of-t
52d0: 68 65 2d 73 70 65 63 20 47 65 6f 4a 53 4f 4e 20 he-spec GeoJSON
52e0: 66 69 6c 65 73 20 62 61 73 65 64 20 6f 6e 20 73 files based on s
52f0: 6f 6d 65 20 61 72 62 69 74 72 61 72 79 20 43 6f ome arbitrary Co
5300: 6f 72 64 69 6e 61 74 65 20 52 65 66 65 72 65 6e ordinate Referen
5310: 63 65 20 53 79 73 74 65 6d 2e 3c 62 72 3e 0d 0a ce System.<br>..
5320: 42 79 20 64 65 66 61 75 6c 74 20 56 69 72 74 75 By default Virtu
5330: 61 6c 47 65 6f 4a 53 4f 4e 20 77 69 6c 6c 20 61 alGeoJSON will a
5340: 6c 77 61 79 73 20 61 73 73 75 6d 65 20 74 68 61 lways assume tha
5350: 74 20 61 6c 6c 20 47 65 6f 6d 65 74 72 69 65 73 t all Geometries
5360: 20 73 68 6f 75 6c 64 20 62 65 20 61 73 73 69 67 should be assig
5370: 6e 65 64 20 74 6f 20 3c 62 3e 53 52 49 44 3d 34 ned to <b>SRID=4
5380: 33 32 36 20 57 47 53 20 38 34 3c 2f 62 3e 20 28 326 WGS 84</b> (
5390: 3c 69 3e 6c 6f 6e 67 69 74 75 64 65 73 20 61 6e <i>longitudes an
53a0: 64 20 6c 61 74 69 74 75 64 65 73 3c 2f 69 3e 29 d latitudes</i>)
53b0: 2c 20 61 63 63 6f 72 64 69 6e 67 6c 79 20 74 6f , accordingly to
53c0: 20 52 46 43 20 37 39 34 36 20 73 70 65 63 69 66 RFC 7946 specif
53d0: 69 63 61 74 69 6f 6e 73 2e 3c 2f 6c 69 3e 0d 0a ications.</li>..
53e0: 3c 6c 69 3e 41 20 66 75 72 74 68 65 72 20 6f 70 <li>A further op
53f0: 74 69 6f 6e 61 6c 20 61 72 67 75 6d 65 6e 74 20 tional argument
5400: 3c 62 3e 63 6f 6c 6e 61 6d 65 5f 63 61 73 65 3c <b>colname_case<
5410: 2f 62 3e 20 69 73 20 73 75 70 70 6f 72 74 65 64 /b> is supported
5420: 2c 20 61 6e 64 20 69 74 20 68 61 73 20 65 78 61 , and it has exa
5430: 63 74 6c 79 20 74 68 65 20 73 61 6d 65 20 69 6e ctly the same in
5440: 74 65 72 70 72 65 74 61 74 69 6f 6e 73 20 61 73 terpretations as
5450: 20 69 6e 20 3c 62 3e 49 6d 70 6f 72 74 47 65 6f in <b>ImportGeo
5460: 4a 53 4f 4e 28 29 3c 2f 62 3e 3c 2f 6c 69 3e 0d JSON()</b></li>.
5470: 0a 3c 2f 75 6c 3e 0d 0a 3c 62 72 3e 0d 0a 3c 68 .</ul>..<br>..<h
5480: 72 3e 0d 0a 3c 68 33 3e 47 65 6f 4a 53 4f 4e 20 r>..<h3>GeoJSON
5490: 73 75 70 70 6f 72 74 20 69 6e 20 73 70 61 74 69 support in spati
54a0: 61 6c 69 74 65 5f 67 75 69 3c 2f 68 33 3e 0d 0a alite_gui</h3>..
54b0: 3c 62 72 3e 3c 62 72 3e 0d 0a 3c 68 72 3e 3c 62 <br><br>..<hr><b
54c0: 72 3e 0d 0a 3c 61 20 68 72 65 66 3d 22 68 74 74 r>..<a href="htt
54d0: 70 73 3a 2f 2f 77 77 77 2e 67 61 69 61 2d 67 69 ps://www.gaia-gi
54e0: 73 2e 69 74 2f 66 6f 73 73 69 6c 2f 6c 69 62 73 s.it/fossil/libs
54f0: 70 61 74 69 61 6c 69 74 65 2f 77 69 6b 69 3f 6e patialite/wiki?n
5500: 61 6d 65 3d 34 2e 33 2e 30 2d 64 6f 63 22 3e 62 ame=4.3.0-doc">b
5510: 61 63 6b 3c 2f 61 3e 0a 5a 20 64 62 35 30 62 33 ack</a>.Z db50b3
5520: 37 34 36 30 62 64 37 39 63 38 39 66 64 39 38 66 7460bd79c89fd98f
5530: 66 64 31 61 34 62 37 34 63 66 0a fd1a4b74cf.