4!#!1
4!#!1 .eograp%+.eograp%+
-penSreeMap sores he coor"inaes as a "o'5le6precision ?oatng6poin ype representng he lat'"e -penSreeMap sores he coor"inaes as a "o'5le6precision ?oatng6poin ype representng he lat'"e an" he longi'"e o each poin, 'sing he &GS san"ar". The 5asis or he -SM "aa is a sphere an" an" he longi'"e o each poin, 'sing he &GS san"ar". The 5asis or he -SM "aa is a sphere an" spatal ea'res are represene" on `geographic` coor"inaes $so!et!es calle" `geo"etc` coor"inaes or spatal ea'res are represene" on `geographic` coor"inaes $so!et!es calle" `geo"etc` coor"inaes or `lat'"e>longi'"e`%, e8presse" in ang'lar 'nis $"egrees%.
`lat'"e>longi'"e`%, e8presse" in ang'lar 'nis $"egrees%.
Geographies are 'niersally accepe" coor"inaes $B'rro'gh an" Mc*onnell 1FF, pages 100J101%, 5' Geographies are 'niersally accepe" coor"inaes $B'rro'gh an" Mc*onnell 1FF, pages 100J101%, 5' he calc'latons on geographies $areas, "isances, lenghs, inersectons, ec% !'s 5e peror!e" on he he calc'latons on geographies $areas, "isances, lenghs, inersectons, ec% !'s 5e peror!e" on he sphe
sphere, re, 'sing !ore 'sing !ore co!pleco!ple8 8 !ahe!ahe!atcs!atcs. . @or @or !ore acc'rae !eas're!ore acc'rae !eas're!ens!ens, , he calc'latonhe calc'latons s !'s a(e!'s a(e he ac'al spheroi"al shape o he orl" ino acco'n, an" he !ahe!atcs 5eco!e ery co!plicae" he ac'al spheroi"al shape o he orl" ino acco'n, an" he !ahe!atcs 5eco!e ery co!plicae" in"ee". Geographies ill correcly han"le <'eries ha coer he poles or he inernatonal "ae6line, hile in"ee". Geographies ill correcly han"le <'eries ha coer he poles or he inernatonal "ae6line, hile a pro;ece" "aase on a plane ill no.
a pro;ece" "aase on a plane ill no.
The -SM "aa !o"el in Neo;6Spatal, creae" 5y he -SMI!porer class, is "esigne" o !i!ic he The -SM "aa !o"el in Neo;6Spatal, creae" 5y he -SMI!porer class, is "esigne" o !i!ic he co!pl
co!plee conenee conens o s o he ML he ML flefles proi"e" or -SM. s proi"e" or -SM. #s a #s a res'lres'l, coor"ina, coor"inaes in es in he Neo; "aa5ashe Neo; "aa5ase aree are also spherical coor"inaes e8presse" in ang'lar 'nis $"egrees%. The i!por 'ncton is c'rrenly 'na5le o also spherical coor"inaes e8presse" in ang'lar 'nis $"egrees%. The i!por 'ncton is c'rrenly 'na5le o pro;ec he "aa !o"el on a plane.
pro;ec he "aa !o"el on a plane.
*aa is sore" in 5oh "aa5ases as geographies J &GS longi'"e>lat'"e $SI*C2H% J 'sing he *aa is sore" in 5oh "aa5ases as geographies J &GS longi'"e>lat'"e $SI*C2H% J 'sing he al'es ro! -SM "aa iho' conersion. Noe ha calc'latons on a sphere are co!p'atonally ar !ore al'es ro! -SM "aa iho' conersion. Noe ha calc'latons on a sphere are co!p'atonally ar !ore e8pensie han caresian calc'latons. @or e8a!ple, he caresian or!'la or "isance $+yhagoras% inoles e8pensie han caresian calc'latons. @or e8a!ple, he caresian or!'la or "isance $+yhagoras% inoles one call o s<r$%. The spherical or!'la or "isance $aersine% inoles o s<r$% calls, an arcan$% call, one call o s<r$%. The spherical or!'la or "isance $aersine% inoles o s<r$% calls, an arcan$% call, o'r sin$% calls an" o cos$% calls. Geography 'nctons are ery cosly, an" spherical calc'latons inole a o'r sin$% calls an" o cos$% calls. Geography 'nctons are ery cosly, an" spherical calc'latons inole a lo o he!.
lo o he!.
4!#!#
4!#!# Neo,&Neo,&
This paragraph "escri5es ho -SM "aa is sore" in Neo;. The ay Neo;6Spatal sores -SM "aa is no This paragraph "escri5es ho -SM "aa is sore" in Neo;. The ay Neo;6Spatal sores -SM "aa is no "escri5e" in he "oc'!enaton !os o he inor!aton in his paragraph has 5een reerse engineere". "escri5e" in he "oc'!enaton !os o he inor!aton in his paragraph has 5een reerse engineere". The Neo;6S
The Neo;6Spatal so'rce co"e has 5een patal so'rce co"e has 5een analyanaly9e" ih Ne5eans I*7 an" 9e" ih Ne5eans I*7 an" he creae" "aasehe creae" "aases hae 5eens hae 5een is'ali9e" ih a soare pac(age calle" Neo/lipse. # s!all 3a(e3 -SM "aase is creae" conaining a is'ali9e" ih a soare pac(age calle" Neo/lipse. # s!all 3a(e3 -SM "aase is creae" conaining a agge" no"e, a railay an" a 5'il"ing. This allos 's o see he graph in Neo/lipse.
agge" no"e, a railay an" a 5'il"ing. This allos 's o see he graph in Neo/lipse. I!portng -SM "aa is 5'il6in ih he
I!portng -SM "aa is 5'il6in ih he org.neo!C.gis.s$atia,.os.OSMD$orterorg.neo!C.gis.s$atia,.os.OSMD$orter class an" r'ns in o phases. class an" r'ns in o phases. The frs phase re<'ires a 5ach inserer on he "aa5ase, an" he ne8 phase creaes an in"e8 on he "aa. The frs phase re<'ires a 5ach inserer on he "aa5ase, an" he ne8 phase creaes an in"e8 on he "aa. The se<'enc
The se<'ence e here is here is sar 5ach inserersar 5ach inserer, , i!pori!por flfle, sh'"on 5ach inserere, sh'"on 5ach inserer, , sarsar "aa5"aa5ase, rein"e8ase, rein"e8,,
C2 C2
Figure 1?: 9osDE$ dashboard Figure 1?: 9osDE$ dashboard
sh'"on "aa5ase, his is ill'srae" ih
sh'"on "aa5ase, his is ill'srae" ih Snippe C. Snippe C.
The res'ltng "aa !o"el is "esigne" o !i!ic he co!plee conens o he ML fles proi"e" 5y -SM. The res'ltng "aa !o"el is "esigne" o !i!ic he co!plee conens o he ML fles proi"e" 5y -SM. 7ery 5asic -SM ele!en is represene" 5y a 'ni<'e no"e. To gain so!e !ore insigh in ho he graph 7ery 5asic -SM ele!en is represene" 5y a 'ni<'e no"e. To gain so!e !ore insigh in ho he graph "aa5ase can 5e <'erie", a high6leel propery gr
"aa5ase can 5e <'erie", a high6leel propery gr aph o -penSreeMap "aa in Neo; iaph o -penSreeMap "aa in Neo; is consi"ere" $s consi"ere" $ @ig're@ig're 1E
1E%. Kertces in his graph represen%. Kertces in his graph represen a a gro'p o co!ponengro'p o co!ponens, s'ch as s, s'ch as layerlayers, -SM pri!ite or ags. Thes, -SM pri!ite or ags. The e"g
e"ges es o o he he gragraph ph conconnecnec hohose se co!co!poneponens ha ns ha are relaare relae". To e". To ge he ge he proproperpertes o tes o a a LinLineSeSrinringg geo!ery, one nee"s o raerse ro! he geo!ery no"e o he ay no"e an
geo!ery, one nee"s o raerse ro! he geo!ery no"e o he ay no"e an" fnally o he ags no"e $o" fnally o he ags no"e $o ge he ags%. Th's, i is also possi5le o gain insigh in hich -SM ays are creae" in a partc'lar change6 ge he ags%. Th's, i is also possi5le o gain insigh in hich -SM ays are creae" in a partc'lar change6 se. This (nole"g
se. This (nole"ge can e can 5e o5aine" 5y raersing he graph. @or 5e o5aine" 5y raersing he graph. @or his p'rposhis p'rpose he e he Neo; graph "aa5asNeo; graph "aa5asee proi
proi"es a "es a nate =aa #+I nate =aa #+I an" he an" he Gre!Gre!lin lin $gre!l$gre!lin.tnin.tn(erpo(erpop.co! 2012% p.co! 2012% graph progra!!graph progra!!ing lang'age.ing lang'age. Gre!lin is a relately si!ple an" "aa5ase
Gre!lin is a relately si!ple an" "aa5ase6agnostc lang'age ih a syna8 si!ilar o +ah. )sing Gre!lin,6agnostc lang'age ih a syna8 si!ilar o +ah. )sing Gre!lin, graph <'eries can 5e e8presse" in a s'ccinc ay.
graph <'eries can 5e e8presse" in a s'ccinc ay.
)sing he graph !o"el in a "irec ay o'l" re<'ire precise (nole"ge on ho he -SM "aa is !o"ele" )sing he graph !o"el in a "irec ay o'l" re<'ire precise (nole"ge on ho he -SM "aa is !o"ele" in
in NeNeoo;. ;. aahherer, , i i is is 5e5e:e:er r o o 's'se e hhe e -S-SM M #+#+I I prprooi"ei"e" " in in hhe e -S-SMLMLayayerer, , -S-SM*M*aaasase e anan"" -SMGe
-SMGeo!eo!ery7ncory7nco"er classes. In "er classes. In Neo;Neo;6Spat6Spatal al eereery y geo!egeo!ery is ry is reprerepresensene" e" 5y a 5y a 'ni<''ni<'e e no"e, 5' no"e, 5' aa no"e nee" no necessarily conain coor"inaes or ags. This is o'line" 5y he Geo!ery7nco"er class. The no"e nee" no necessarily conain coor"inaes or ags. This is o'line" 5y he Geo!ery7nco"er class. The Geo!ery7nco"er "efnes c'so! approaches o soring geo!eries in he "aa5ase graph. There are o Geo!ery7nco"er "efnes c'so! approaches o soring geo!eries in he "aa5ase graph. There are o pri!ary approaches
pri!ary approaches
•• ,n-node,n-node This approach !a(es 'se o propertes o an in"ii"'al no"e o sore he geo!ery. The This approach !a(es 'se o propertes o an in"ii"'al no"e o sore he geo!ery. The 5'il
5'il6in &PT 6in &PT $&ell6$&ell6Pnon Te8% an" Pnon Te8% an" &PB $&ell6Pno&PB $&ell6Pnon Binary% enco"ers 'se his approach, 5' an Binary% enco"ers 'se his approach, 5' a c'so! enco"er si!ply soring a ?oaUV o coor"inaes o a LineSring o'l" also 5e classe" here. c'so! enco"er si!ply soring a ?oaUV o coor"inaes o a LineSring o'l" also 5e classe" here. •• Su-graphSu-graph This approach !a(es 'se o a graph o no"es an" relatonships o "escri5e a single This approach !a(es 'se o a graph o no"es an" relatonships o "escri5e a single
geo!ery. This co'l" 5e as si!ple as a chain o no"es representng a LineSring or a co!ple8 nese" geo!ery. This co'l" 5e as si!ple as a chain o no"es representng a LineSring or a co!ple8 nese" graph li(e he -SM approach o M'lt+olygons.
graph li(e he -SM approach o M'lt+olygons.
CC CC
Figure 1A: Neo4Hs high-le3el daa !odel for B$ daa
Figure 1A: Neo4Hs high-le3el daa !odel for B$ daa 'si!pli/ed*'si!pli/ed*
OSMD$orter i$orter =
OSMD$orter i$orter = ne:ne: OSMD$orter",a2ernae" OSMD$orter",a2ernae"@@ EatcDnserterD$, atcDnserter =
EatcDnserterD$, atcDnserter = ne:ne: EatcDnserterD$, EatcDnserterD$,dirdir77 con;igcon;ig@@ i$orter.i$ortFi,eatcDnserter7
i$orter.i$ortFi,eatcDnserter7 "data.os""data.os"77 ;a,se;a,se@@ atcDnserter.s)tdo:n@
atcDnserter.s)tdo:n@ ra$5ataaseService d =
ra$5ataaseService d = ne:ne: eddedra$5ataase eddedra$5ataasedirdir@@ i$orter.reDnded7 10000@
i$orter.reDnded7 10000@ d.s)tdo:n@
d.s)tdo:n@
$nippe =: E!por B$ daa $nippe =: E!por B$ daa
NoSQL spatal NoSQL spatal 78
78en"en"ing ing he e8a!phe e8a!ple le a5oa5oe,e, org.neo!C.gis.s$atia,.os.OSM5atasetorg.neo!C.gis.s$atia,.os.OSM5ataset proi"es a !eho" or gedng a &ay proi"es a !eho" or gedng a &ay o5;ec
o5;ec ro! a ro! a no"eno"e he re'rne" o5;ec can 5e <'erie" or is geo!er he re'rne" o5;ec can 5e <'erie" or is geo!eries. Beca'sies. Beca'se o e o he na're o hehe na're o he -SM graph, !os no"es "o no represen poin geo!eries, 5' are par o co!ple8 geo!eries $srees, -SM graph, !os no"es "o no represen poin geo!eries, 5' are par o co!ple8 geo!eries $srees, regions, 5'il"ings, ec.%.
regions, 5'il"ings, ec.%.
The la>long al'es are sore" <'ie a 5i "eeper in he graph. In he case o a &ay, here is a chain o The la>long al'es are sore" <'ie a 5i "eeper in he graph. In he case o a &ay, here is a chain o reerence no"es ha r'ns ro! he frs o he las no"e o he ay. 7ach o hese no"es has a relatons reerence no"es ha r'ns ro! he frs o he las no"e o he ay. 7ach o hese no"es has a relatonshiphip o
o ananooheher r nono"e "e $$he he -S-SM M NoNo"e"e% % hha a coconnaiains ns hhe e lolocacatoton n $l$laa>l>lonong g aal'l'e%e%. . ThThe e rereasason on oor r hhee iner!e"iae no"es is 5eca'se he locaton no"es can e8is in !'ltple ays.
iner!e"iae no"es is 5eca'se he locaton no"es can e8is in !'ltple ays. Mos poins in he -SM !o"elMos poins in he -SM !o"el are no e8pose" as poin geo!eries in he spatal in"e8. This is 5eca'se !os o he! are inen"e" as pars are no e8pose" as poin geo!eries in he spatal in"e8. This is 5eca'se !os o he! are inen"e" as pars o larger geo!e
o larger geo!eries. @or e8a!pries. @or e8a!ple, i so!eone creale, i so!eone creae" a la(e in e" a la(e in -SM, !a"e o 100 poins in a -SM, !a"e o 100 poins in a polygopolygon,n, hose 100 poins o'l" no 5e in"e8e" in he
hose 100 poins o'l" no 5e in"e8e" in he spataspatal l in"ein"e8, 5' 8, 5' he polygon o'lhe polygon o'l" 5e. " 5e. )sing he spata)sing he spatall in"e8 o fn" any ar5irary poin o he la(e ill no or(, as only poins ha are agge" in"ii"'ally ill in"e8 o fn" any ar5irary poin o he la(e ill no or(, as only poins ha are agge" in"ii"'ally ill appear in he spatal in"e8.
appear in he spatal in"e8.
*iing een 'rher in Neo;6Spatal shos he "aa ypes 'se" o sore -SM "aa.
*iing een 'rher in Neo;6Spatal shos he "aa ypes 'se" o sore -SM "aa. @ig're 1,@ig're 1, 5elo, shos 5elo, shos a "aa "'!p hich is he ra a(e -SM "aa ih i!poran par
a "aa "'!p hich is he ra a(e -SM "aa ih i!poran pars o he graph annoae". # 'll resol'tons o he graph annoae". # 'll resol'ton i!age o he graph is incl'"e" in #ppen"i8 III.
i!age o he graph is incl'"e" in #ppen"i8 III.
The 3-SM in
The 3-SM in a graph3 "aa a graph3 "aa sr'sr'c're is e8plainec're is e8plaine" as " as a raersaa raersal, naigatnl, naigatng g ro! sartro! sartng no"es o ng no"es o relaerelae"" no"es in he or! o XNo"es are organi9e" 5y elatonships, hich also hae +ropertesY.
no"es in he or! o XNo"es are organi9e" 5y elatonships, hich also hae +ropertesY. #s e8plaine" in paragraph
#s e8plaine" in paragraph .2.1.2.1, he "aa !o"el is a propery graph conaining no"es an" relatons, an", he "aa !o"el is a propery graph conaining no"es an" relatons, an" 5oh o he! can
5oh o he! can hae (ey>hae (ey>al'e syle propeal'e syle propertesrtes. The . The Neo; classeNeo; classes s proi"proi"e" ine" in org.neo!C.gis.s$atia,.osorg.neo!C.gis.s$atia,.os OSMa2er
OSMa2er,, org.neo!C.gis.s$atia,.os.OSM5atasetorg.neo!C.gis.s$atia,.os.OSM5ataset a ann"" org.neo!C.gis.s$atia,.os.OSMeoetr2ncoderorg.neo!C.gis.s$atia,.os.OSMeoetr2ncoder enens's're re hhee sr'c're o he graph. #er i!portng he -SM fle, as ill'srae" in
sr'c're o he graph. #er i!portng he -SM fle, as ill'srae" in Snippe C,Snippe C, he co!ponens "escri5e" he co!ponens "escri5e" 5elo can 5e recogni9e".
5elo can 5e recogni9e".
An 6S2 graph dataase has a 7 Spa%al entry8 and also the 7 6S2-related data An 6S2 graph dataase has a 7 Spa%al entry8 and also the 7 6S2-related data Neo;
Neo; co!es co!es ih ih a a 5'il6in 5'il6in reerence reerence no"e no"e $is'ali9e" $is'ali9e" as as in in he he #ppen"i8%, #ppen"i8%, hich hich is is a a sartng sartng poin poin inin he no"e space. The sar no"e conains he -penSreeMap par an" he spatal par o he "aa.
he no"e space. The sar no"e conains he -penSreeMap par an" he spatal par o he "aa. 9he spa%al entry is organi!ed y 7 $ayers
9he spa%al entry is organi!ed y 7 $ayers
This is he spatal par o he "aa5ase. # spatal graph "aa5ase can conain !'ltple layers. This is he spatal par o he "aa5ase. # spatal graph "aa5ase can conain !'ltple layers.
C C
Figure 1C: Neo4 ra daa Figure 1C: Neo4 ra daa
$ayers are organi!ed y 7 Dynamic $
$ayers are organi!ed y 7 Dynamic $ayers8 and also a reference to ayers8 and also a reference to the 7 R-tree ,ndethe 7 R-tree ,nde
This no"e has inor!aton a5o' so!e 5asic spatal propertes o a layer. I!poran is he reerence o he This no"e has inor!aton a5o' so!e 5asic spatal propertes o a layer. I!poran is he reerence o he o classes ha "eer!ine ho he
o classes ha "eer!ine ho he "aa5ase is consr'ce" -SMLayer an" "aa5ase is consr'ce" -SMLayer an" -SMGeo!ery7nco"er.-SMGeo!ery7nco"er. Table ?: Neo4-$patal layers daa srucure
Table ?: Neo4-$patal layers daa srucure K
Keeyy 99yyppee DDeessccrriipp%%oonn
cctt!!ee lloonngg TTii!!eessaa!!p p hhe e llaayyeer r iis s ccrreeaaee" " iin n ))nnii8 8 tt!!ee geo
geo!en!enco"co"erer srsringing The clThe class ass ha is 'ha is 'se" se" o creo creae hae he geoe geo!e!eriesries n
naa!!ee ssrriinngg TThhe e nnaa!!e e oo hhe e llaayyeerr la
layeyerrclclasasss ssriringng ThThe ce clalass ss hha a is is 's'se" e" o o crcreaeae e hhe le layayerer la
layeyerprproropsps ssriringng #l#ll l prpropoperertetes s hha a e8e8isiss s in in hhe le layayerer lay
layerercrscrs ssriringng -pt-ptononal al InInor!or!atoaton an a5o5o' ' hhe /e /oooor"r"inainae e eeeerenrence ce SySysse! e! or or hhis is lalayeyer. r. NoNo " "efefnene" h" hereere or an -SM layer, his is "efne" in he -SMLayer class
or an -SM layer, his is "efne" in he -SMLayer class Dynamic $ayers
Dynamic $ayers
78en"s a layer o 5e a5le o e8press isel as seeral 3s'56layers3. 7ach "yna!ic layer is "efne" 5y a""ing 78en"s a layer o 5e a5le o e8press isel as seeral 3s'56layers3. 7ach "yna!ic layer is "efne" 5y a""ing flers o he original layer. The flers are confg're" in he <'ery (ey. -ne (ey e8a!ple o here his ype flers o he original layer. The flers are confg're" in he <'ery (ey. -ne (ey e8a!ple o here his ype