Routing OpenStreetMap · Routing OpenStreetMap Zero Cho. A quick recap on Graph. node edge weight 1...
Transcript of Routing OpenStreetMap · Routing OpenStreetMap Zero Cho. A quick recap on Graph. node edge weight 1...
-
Routing OpenStreetMapZero Cho
-
A quick recap on Graph
-
node
edge
1weight
5
1
10
-
node
edge
1weight
5
1
10
shortest path, weight = 7
-
GeorgiaInstitute
ofTechnology
daoR
lliMl
lewo
H
WNtSht41
teertSa
tteir
aM
WNtSht01
WNtSht41
TechPkyNW
WNev
Allih
pme
H
WNeunevAhtroN
FerstD
rNW
FerstDr NW
Williams S
tNW
SpringStN
W10thStNE
14thStNE
tSeerthcaeP
WPe
achtreeSt
NW
tSeerthcaeP
-
GeorgiaInstitute
ofTechnology
daoR
lliMl
lewo
H
WNtSht41
teertSa
tteir
aM
WNtSht01
WNtSht41
TechPkyNW
WNev
Allih
pme
H
WNeunevAhtroN
FerstD
rNW
FerstDr NW
Williams S
tNW
SpringStN
W10thStNE
14thStNE
tSeerthcaeP
WPe
achtreeSt
NW
tSeerthcaeP
-
How is routing done?
-
many ways. We will talk about A-star algorithm today.
-
S
1
E
2
node 1/-10
5/6
1/1
10/10
7/5
-
S
1
E
2
node 1/-10
5/6
1/1
10/10
7/5
-
S
1
E
2
node 1/-10
5/6
1/1
10/10
7/5
1
2
0 + 5
0 + 6
-
S
1
E
2
node 1/-10
5/6
1/1
10/10
7/5
20 + 6 5 - 10
E5 + 1
-
S
1
E
2
node 1/-10
5/6
1/1
10/10
7/5
E5 + 1 -5 + 10
-
S
1
E
2
node 1/-10
5/6
1/1
10/10
7/5
E5
-
which leads us to my first result… A* OpenStreetMap router written in Ruby
https://github.com/itszero/osm-simple-router
https://github.com/itszero/osm-simple-router
-
which is great… except it’s…
-
so slow.
-
How do we improve it?
-
Moving to neo4j a Graph-based database.
-
Cypher Query Language
MATCH (actor:Person)-[:ACTED_IN]->(movie:Movie)WHERE movie.title =~ "T.*"RETURN movie.title as title, collect(actor.name) as castORDER BY title ASC LIMIT 10;
-
Sure it helps having proper storing and querying engine, but the data is still too much.
~25x improves? 5 secs?
-
intersections
-
overlay link
3 5
8*
-
take Atlanta metro area for an example
2,567,916 nodes ➔ 452,313 (-83%) 10,669,432 relationships ➔ 1,843,440 (-83%)
4.65 secs. routing time ➔ 1.30 secs.
-
Now we have the algorithm, all we need to do is plug it
into the database.
-
which leads us to my second result… A* OpenStreetMap router for Neo4j
https://github.com/itszero/neo4j-astar-example(code is really ugly tho)
https://github.com/itszero/neo4j-astar-example
-
Questions?