• No results found

4!# (ata (ata structure structure

In document NoSQL vs SQL Geo DB (Page 44-51)

4!#!1

4!#!1 .eograp%+.eograp%+

-penSreeMap sores he coor"inaes as a "o'5le6precision ?oatng6poin ype representng he lat'"e -penSreeMap sores he coor"inaes as a "o'5le6precision ?oatng6poin ype representng he lat'"e an" he longi'"e o each poin, 'sing he &GS san"ar". The 5asis or he -SM "aa is a sphere an" an" he longi'"e o each poin, 'sing he &GS san"ar". The 5asis or he -SM "aa is a sphere an" spatal ea'res are represene" on `geographic` coor"inaes $so!et!es calle" `geo"etc` coor"inaes or spatal ea'res are represene" on `geographic` coor"inaes $so!et!es calle" `geo"etc` coor"inaes or `lat'"e>longi'"e`%, e8presse" in ang'lar 'nis $"egrees%.

`lat'"e>longi'"e`%, e8presse" in ang'lar 'nis $"egrees%.

Geographies are 'niersally accepe" coor"inaes $B'rro'gh an" Mc*onnell 1FF, pages 100J101%, 5' Geographies are 'niersally accepe" coor"inaes $B'rro'gh an" Mc*onnell 1FF, pages 100J101%, 5' he calc'latons on geographies $areas, "isances, lenghs, inersectons, ec% !'s 5e peror!e" on he he calc'latons on geographies $areas, "isances, lenghs, inersectons, ec% !'s 5e peror!e" on he sphe

sphere, re, 'sing !ore 'sing !ore co!pleco!ple8 8 !ahe!ahe!atcs!atcs. . @or @or !ore acc'rae !eas're!ore acc'rae !eas're!ens!ens, , he calc'latonhe calc'latons s !'s a(e!'s a(e he ac'al spheroi"al shape o he orl" ino acco'n, an" he !ahe!atcs 5eco!e ery co!plicae" he ac'al spheroi"al shape o he orl" ino acco'n, an" he !ahe!atcs 5eco!e ery co!plicae" in"ee". Geographies ill correcly han"le <'eries ha coer he poles or he inernatonal "ae6line, hile in"ee". Geographies ill correcly han"le <'eries ha coer he poles or he inernatonal "ae6line, hile a pro;ece" "aase on a plane ill no.

a pro;ece" "aase on a plane ill no.

The -SM "aa !o"el in Neo;6Spatal, creae" 5y he -SMI!porer class, is "esigne" o !i!ic he The -SM "aa !o"el in Neo;6Spatal, creae" 5y he -SMI!porer class, is "esigne" o !i!ic he co!pl

co!plee conenee conens o s o he ML he ML flefles proi"e" or -SM. s proi"e" or -SM. #s a #s a res'lres'l, coor"ina, coor"inaes in es in he Neo; "aa5ashe Neo; "aa5ase aree are also spherical coor"inaes e8presse" in ang'lar 'nis $"egrees%. The i!por 'ncton is c'rrenly 'na5le o also spherical coor"inaes e8presse" in ang'lar 'nis $"egrees%. The i!por 'ncton is c'rrenly 'na5le o pro;ec he "aa !o"el on a plane.

pro;ec he "aa !o"el on a plane.

*aa is sore" in 5oh "aa5ases as geographies J &GS  longi'"e>lat'"e $SI*C2H% J 'sing he *aa is sore" in 5oh "aa5ases as geographies J &GS  longi'"e>lat'"e $SI*C2H% J 'sing he al'es ro! -SM "aa iho' conersion. Noe ha calc'latons on a sphere are co!p'atonally ar !ore al'es ro! -SM "aa iho' conersion. Noe ha calc'latons on a sphere are co!p'atonally ar !ore e8pensie han caresian calc'latons. @or e8a!ple, he caresian or!'la or "isance $+yhagoras% inoles e8pensie han caresian calc'latons. @or e8a!ple, he caresian or!'la or "isance $+yhagoras% inoles one call o s<r$%. The spherical or!'la or "isance $aersine% inoles o s<r$% calls, an arcan$% call, one call o s<r$%. The spherical or!'la or "isance $aersine% inoles o s<r$% calls, an arcan$% call, o'r sin$% calls an" o cos$% calls. Geography 'nctons are ery cosly, an" spherical calc'latons inole a o'r sin$% calls an" o cos$% calls. Geography 'nctons are ery cosly, an" spherical calc'latons inole a lo o he!.

lo o he!.

4!#!#

4!#!# Neo,&Neo,&

This paragraph "escri5es ho -SM "aa is sore" in Neo;. The ay Neo;6Spatal sores -SM "aa is no This paragraph "escri5es ho -SM "aa is sore" in Neo;. The ay Neo;6Spatal sores -SM "aa is no "escri5e" in he "oc'!enaton !os o he inor!aton in his paragraph has 5een reerse engineere". "escri5e" in he "oc'!enaton !os o he inor!aton in his paragraph has 5een reerse engineere". The Neo;6S

The Neo;6Spatal so'rce co"e has 5een patal so'rce co"e has 5een analyanaly9e" ih Ne5eans I*7 an" 9e" ih Ne5eans I*7 an" he creae" "aasehe creae" "aases hae 5eens hae 5een is'ali9e" ih a soare pac(age calle" Neo/lipse. # s!all 3a(e3 -SM "aase is creae" conaining a is'ali9e" ih a soare pac(age calle" Neo/lipse. # s!all 3a(e3 -SM "aase is creae" conaining a agge" no"e, a railay an" a 5'il"ing. This allos 's o see he graph in Neo/lipse.

agge" no"e, a railay an" a 5'il"ing. This allos 's o see he graph in Neo/lipse. I!portng -SM "aa is 5'il6in ih he

I!portng -SM "aa is 5'il6in ih 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 5ach inserer on he "aa5ase, an" he ne8 phase creaes an in"e8 on he "aa. The frs phase re<'ires a 5ach inserer on he "aa5ase, an" he ne8 phase creaes an in"e8 on he "aa. The se<'enc

The se<'ence e here is here is sar 5ach inserersar 5ach inserer, , i!pori!por  flfle, sh'"on 5ach inserere, sh'"on 5ach inserer, , sarsar  "aa5"aa5ase, rein"e8ase, rein"e8,,

C2 C2

Figure 1?: 9osDE$ dashboard  Figure 1?: 9osDE$ dashboard 

sh'"on "aa5ase, his is ill'srae" ih

sh'"on "aa5ase, his is ill'srae" ih Snippe C. Snippe C.

The res'ltng "aa !o"el is "esigne" o !i!ic he co!plee conens o he ML fles proi"e" 5y -SM. The res'ltng "aa !o"el is "esigne" o !i!ic he co!plee conens o he ML fles proi"e" 5y -SM. 7ery 5asic -SM ele!en is represene" 5y a 'ni<'e no"e. To gain so!e !ore insigh in ho he graph 7ery 5asic -SM ele!en is represene" 5y a 'ni<'e no"e. To gain so!e !ore insigh in ho he graph "aa5ase can 5e <'erie", a high6leel propery gr

"aa5ase can 5e <'erie", a high6leel propery gr aph o -penSreeMap "aa in Neo; iaph o -penSreeMap "aa 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!ponengro'p o co!ponens, s'ch as s, s'ch as layerlayers, -SM pri!ite or ags. Thes, -SM pri!ite or ags. The e"g

e"ges es o o he he gragraph ph conconnecnec  hohose se co!co!poneponens ha ns ha are relaare relae". To e". To ge he ge he proproperpertes o tes o a a LinLineSeSrinringg geo!ery, one nee"s o raerse ro! he geo!ery no"e o he ay no"e an

geo!ery, one nee"s o raerse ro! he geo!ery 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 creae" in a partc'lar change6 ge he ags%. Th's, i is also possi5le o gain insigh in hich -SM ays are creae" in a partc'lar change6 se. This (nole"g

se. This (nole"ge can e can 5e o5aine" 5y raersing he graph. @or 5e o5aine" 5y raersing he graph. @or his p'rposhis p'rpose he e he Neo; graph "aa5asNeo; graph "aa5asee proi

proi"es a "es a nate =aa #+I nate =aa #+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 relately si!ple an" "aa5ase

Gre!lin is a relately si!ple an" "aa5ase6agnostc lang'age ih a syna8 si!ilar o +ah. )sing Gre!lin,6agnostc lang'age ih a syna8 si!ilar o +ah. )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 (nole"ge on ho he -SM "aa is !o"ele" )sing he graph !o"el in a "irec ay o'l" re<'ire precise (nole"ge on ho he -SM "aa is !o"ele" in

in NeNeoo;. ;. aahherer, , i i is is 5e5e:e:er r o o 's'se e hhe e -S-SM M #+#+I I prprooi"ei"e" " in in hhe e -S-SMLMLayayerer, , -S-SM*M*aaasase e anan"" -SMGe

-SMGeo!eo!ery7ncory7nco"er classes. In "er classes. In Neo;Neo;6Spat6Spatal al eereery y geo!egeo!ery is ry is reprerepresensene" e" 5y a 5y a 'ni<''ni<'e e no"e, 5' no"e, 5' aa no"e nee" no necessarily conain coor"inaes or ags. This is o'line" 5y he Geo!ery7nco"er class. The no"e nee" no necessarily conain coor"inaes or ags. This is o'line" 5y he Geo!ery7nco"er class. The Geo!ery7nco"er "efnes c'so! approaches o soring geo!eries in he "aa5ase graph. There are o Geo!ery7nco"er "efnes c'so! approaches o soring geo!eries in he "aa5ase graph. There are o pri!ary approaches

pri!ary approaches

•• ,n-node,n-node This approach !a(es 'se o propertes o an in"ii"'al no"e o sore he geo!ery. The This approach !a(es 'se o propertes o an in"ii"'al no"e o sore he geo!ery. The 5'il

5'il6in &PT 6in &PT $&ell6$&ell6Pnon Te8% an" Pnon Te8% an" &PB $&ell6Pno&PB $&ell6Pnon Binary% enco"ers 'se his approach, 5' an Binary% enco"ers 'se his approach, 5' a c'so! enco"er si!ply soring a ?oaUV o coor"inaes o a LineSring o'l" also 5e classe" here. c'so! enco"er si!ply soring a ?oaUV o coor"inaes o a LineSring 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!ery. This co'l" 5e as si!ple as a chain o no"es representng a LineSring or a co!ple8 nese" geo!ery. This co'l" 5e as si!ple as a chain o no"es representng a LineSring or a co!ple8 nese" graph li(e he -SM approach o M'lt+olygons.

graph li(e he -SM approach o M'lt+olygons.

CC CC

Figure 1A: Neo4Hs high-le3el daa !odel for B$ daa

Figure 1A: Neo4Hs high-le3el daa !odel for B$ daa 'si!pli/ed*'si!pli/ed*

OSMD$orter i$orter =

OSMD$orter i$orter = ne:ne: OSMD$orter",a2ernae" OSMD$orter",a2ernae"@@ EatcDnserterD$, atcDnserter =

EatcDnserterD$, atcDnserter = ne:ne: EatcDnserterD$, EatcDnserterD$,dirdir77 con;igcon;ig@@ i$orter.i$ortFi,eatcDnserter7

i$orter.i$ortFi,eatcDnserter7 "data.os""data.os"77 ;a,se;a,se@@ atcDnserter.s)tdo:n@

atcDnserter.s)tdo:n@ ra$5ataaseService d =

ra$5ataaseService d = ne:ne: eddedra$5ataase eddedra$5ataasedirdir@@ i$orter.reDnded7 10000@

i$orter.reDnded7 10000@ d.s)tdo:n@

d.s)tdo:n@

$nippe =: E!por B$ daa $nippe =: E!por B$ daa

NoSQL spatal NoSQL spatal 78

78en"en"ing ing he e8a!phe e8a!ple le a5oa5oe,e, org.neo!C.gis.s$atia,.os.OSM5atasetorg.neo!C.gis.s$atia,.os.OSM5ataset  proi"es a !eho" or gedng a &ay  proi"es a !eho" or gedng a &ay o5;ec

o5;ec ro! a  ro! a no"eno"e he re'rne" o5;ec can 5e <'erie" or is geo!er he re'rne" o5;ec can 5e <'erie" or is geo!eries. Beca'sies. Beca'se o e o he na're o hehe na're o he -SM graph, !os no"es "o no represen poin geo!eries, 5' are par o co!ple8 geo!eries $srees, -SM graph, !os no"es "o no represen poin geo!eries, 5' are par o co!ple8 geo!eries $srees, regions, 5'il"ings, ec.%.

regions, 5'il"ings, ec.%.

The la>long al'es are sore" <'ie a 5i "eeper in he graph. In he case o a &ay, here is a chain o The la>long al'es are sore" <'ie a 5i "eeper in he graph. In he case o a &ay, here is a chain o reerence no"es ha r'ns ro! he frs o he las no"e o he ay. 7ach o hese no"es has a relatons reerence 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 ananooheher r nono"e "e $$he he -S-SM M NoNo"e"e% % hha a coconnaiains ns hhe e lolocacatoton n $l$laa>l>lonong g aal'l'e%e%. . ThThe e rereasason on oor r hhee iner!e"iae no"es is 5eca'se he locaton no"es can e8is in !'ltple ays.

iner!e"iae no"es is 5eca'se he locaton no"es can e8is in !'ltple ays. Mos poins in he -SM !o"elMos poins in he -SM !o"el are no e8pose" as poin geo!eries in he spatal in"e8. This is 5eca'se !os o he! are inen"e" as pars are no e8pose" as poin geo!eries in he spatal in"e8. This is 5eca'se !os o he! are inen"e" as pars o larger geo!e

o larger geo!eries. @or e8a!pries. @or e8a!ple, i so!eone creale, i so!eone creae" a la(e in e" a la(e in -SM, !a"e o 100 poins in a -SM, !a"e o 100 poins in a polygopolygon,n, hose 100 poins o'l" no 5e in"e8e" in he

hose 100 poins o'l" no 5e in"e8e" in he spataspatal l in"ein"e8, 5' 8, 5' he polygon o'lhe polygon o'l" 5e. " 5e. )sing he spata)sing he spatall in"e8 o fn" any ar5irary poin o he la(e ill no or(, as only poins ha are agge" in"ii"'ally ill in"e8 o fn" any ar5irary poin o he la(e ill no or(, as only poins ha are agge" in"ii"'ally ill appear in he spatal in"e8.

appear in he spatal in"e8.

*iing een 'rher in Neo;6Spatal shos he "aa ypes 'se" o sore -SM "aa.

*iing een 'rher in Neo;6Spatal shos he "aa ypes 'se" o sore -SM "aa. @ig're 1,@ig're 1, 5elo, shos 5elo, shos a "aa "'!p hich is he ra a(e -SM "aa ih i!poran par

a "aa "'!p hich is he ra a(e -SM "aa ih i!poran pars o he graph annoae". # 'll resol'tons o he graph annoae". # '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 "aa a graph3 "aa sr'sr'c're is e8plainec're is e8plaine" as " as a raersaa raersal, naigatnl, naigatng g ro! sartro! sartng no"es o ng no"es o relaerelae"" no"es in he or! o XNo"es are organi9e" 5y  elatonships, hich also hae  +ropertesY.

no"es in he or! o XNo"es are organi9e" 5y  elatonships, hich also hae  +ropertesY. #s e8plaine" in paragraph

#s e8plaine" in paragraph .2.1.2.1, he "aa !o"el is a propery graph conaining no"es an" relatons, an", he "aa !o"el is a propery graph conaining no"es an" relatons, an" 5oh o he! can

5oh o he! can hae (ey>hae (ey>al'e syle propeal'e syle propertesrtes. The . The Neo; classeNeo; classes s proi"proi"e" ine" in org.neo!C.gis.s$atia,.osorg.neo!C.gis.s$atia,.os OSMa2er

OSMa2er,, org.neo!C.gis.s$atia,.os.OSM5atasetorg.neo!C.gis.s$atia,.os.OSM5ataset  a  ann"" org.neo!C.gis.s$atia,.os.OSMeoetr2ncoderorg.neo!C.gis.s$atia,.os.OSMeoetr2ncoder enens's're re hhee sr'c're o he graph. #er i!portng he -SM fle, as ill'srae" in

sr'c're o he graph. #er i!portng he -SM fle, as ill'srae" in Snippe C,Snippe C, he co!ponens "escri5e" he co!ponens "escri5e" 5elo can 5e recogni9e".

5elo can 5e recogni9e".

An 6S2 graph dataase has a 7 Spa%al entry8 and also the 7 6S2-related data An 6S2 graph dataase has a 7 Spa%al entry8 and also the 7 6S2-related data Neo;

Neo; co!es co!es ih ih a a 5'il6in 5'il6in reerence reerence no"e no"e $is'ali9e" $is'ali9e" as as in in he he #ppen"i8%, #ppen"i8%, hich hich is is a a sartng sartng poin poin inin he no"e space. The sar no"e conains he -penSreeMap par an" he spatal par o he "aa.

he no"e space. The sar no"e conains he -penSreeMap par an" he spatal par o he "aa. 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 "aa5ase. # spatal graph "aa5ase can conain !'ltple layers. This is he spatal par o he "aa5ase. # spatal graph "aa5ase can conain !'ltple layers.

C C

Figure 1C: Neo4 ra daa Figure 1C: Neo4 ra daa

$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 ,ndethe 7 R-tree ,nde

This no"e has inor!aton a5o' so!e 5asic spatal propertes o a layer. I!poran is he reerence o he This no"e has inor!aton a5o' so!e 5asic spatal propertes o a layer. I!poran is he reerence o he o classes ha "eer!ine ho he

o classes ha "eer!ine ho he "aa5ase is consr'ce" -SMLayer an" "aa5ase is consr'ce" -SMLayer an" -SMGeo!ery7nco"er.-SMGeo!ery7nco"er. Table ?: Neo4-$patal layers daa srucure

Table ?: Neo4-$patal layers daa srucure K

Keeyy 99yyppee DDeessccrriipp%%oonn

cctt!!ee lloonngg TTii!!eessaa!!p p hhe e llaayyeer r iis s ccrreeaaee" " iin n ))nnii8 8 tt!!ee geo

geo!en!enco"co"erer srsringing The clThe class ass ha is 'ha is 'se" se" o creo creae hae he geoe geo!e!eriesries n

naa!!ee ssrriinngg TThhe e nnaa!!e e oo  hhe e llaayyeerr la

layeyerrclclasasss ssriringng ThThe ce clalass ss hha a is is 's'se" e" o o crcreaeae e hhe le layayerer la

layeyerprproropsps ssriringng #l#ll l prpropoperertetes s hha a e8e8isiss s in in hhe le layayerer lay

layerercrscrs ssriringng -pt-ptononal al InInor!or!atoaton an a5o5o' ' hhe /e /oooor"r"inainae e eeeerenrence ce SySysse! e! or or hhis 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

78en"s a layer o 5e a5le o e8press isel as seeral 3s'56layers3. 7ach "yna!ic layer is "efne" 5y a""ing 78en"s a layer o 5e a5le o e8press isel as seeral 3s'56layers3. 7ach "yna!ic layer is "efne" 5y a""ing flers o he original layer. The flers are confg're" in he <'ery (ey. -ne (ey e8a!ple o here his ype flers o he original layer. The flers are confg're" in he <'ery (ey. -ne (ey e8a!ple o here his ype

In document NoSQL vs SQL Geo DB (Page 44-51)