converting a spatial network to a graph converting a spatial network
TRANSCRIPT
![Page 1: Converting a spatial network to a graph Converting a spatial network](https://reader034.vdocuments.net/reader034/viewer/2022042611/586a1c191a28ab6b518b6d89/html5/thumbnails/1.jpg)
Converting a spatial network to a graphConverting a spatial network to a graph in R
Binbin Lu, Martin CharltonNational Centre for Geocomputation
National University of Ireland Maynooth
Maynooth, Co.Kildare, IrelandMaynooth, Co.Kildare, Ireland
The R User Conference 2011
![Page 2: Converting a spatial network to a graph Converting a spatial network](https://reader034.vdocuments.net/reader034/viewer/2022042611/586a1c191a28ab6b518b6d89/html5/thumbnails/2.jpg)
ContentsContents
Motivation
Key points in the conversionKey points in the conversion
R package “shp2graph”
Future work
![Page 3: Converting a spatial network to a graph Converting a spatial network](https://reader034.vdocuments.net/reader034/viewer/2022042611/586a1c191a28ab6b518b6d89/html5/thumbnails/3.jpg)
MotivationMotivation How should I get all theh t t th b tshortest paths between
any pair of points?
SANNETSANNET
pgRouting……
Coding with Dijkstra algorithmg
ButI am an R user andI am an R user andI am “lazy”
![Page 4: Converting a spatial network to a graph Converting a spatial network](https://reader034.vdocuments.net/reader034/viewer/2022042611/586a1c191a28ab6b518b6d89/html5/thumbnails/4.jpg)
Search in R packagesSearch in R packages…sp between()RBGLgraphmaptools sp.between()
shortest.paths()
RBGLgraph
igraphShape file
maptools
sp
Solution: Converting a spatial network to a graph object
Key points for this conversion:Key points for this conversion:Modelling Road network with graph data model
Attribute heritageg
Topology
Structure optimization
Integration of points into network
![Page 5: Converting a spatial network to a graph Converting a spatial network](https://reader034.vdocuments.net/reader034/viewer/2022042611/586a1c191a28ab6b518b6d89/html5/thumbnails/5.jpg)
Graph data modelGraph data modelEdge (Arc) Node (Vertex)g ( ) ( )
Node listEdge list
ID X Y …NodeID1 NodeID2 …
Matrix
Graph data model:
A kind of data model to abstract away
1ID 2ID nID1ID
ID0 1or
... geographical details and represent a
network as a graph, that is, as a finite
2ID
nID
ija Edgelength ......
set of points called nodes (i.e. vertices)
and relations between these points
ll d d (i )n called edges (i.e. arcs).
![Page 6: Converting a spatial network to a graph Converting a spatial network](https://reader034.vdocuments.net/reader034/viewer/2022042611/586a1c191a28ab6b518b6d89/html5/thumbnails/6.jpg)
Attributes inheritance and translationAttributes inheritance and translation
• Geometry Spatial coordinates of nodes
• Attributes IDs of nodes and edges; IDs of nodes and edges;
Lengths of edges;
Orientation of edges Orientation of edges
……
![Page 7: Converting a spatial network to a graph Converting a spatial network](https://reader034.vdocuments.net/reader034/viewer/2022042611/586a1c191a28ab6b518b6d89/html5/thumbnails/7.jpg)
Topology errors
(a) Dangling arc (b) Undershoot
(c) Overshoot (d) Missing intersection
![Page 8: Converting a spatial network to a graph Converting a spatial network](https://reader034.vdocuments.net/reader034/viewer/2022042611/586a1c191a28ab6b518b6d89/html5/thumbnails/8.jpg)
Connectivity ProblemConnectivity Problem
![Page 9: Converting a spatial network to a graph Converting a spatial network](https://reader034.vdocuments.net/reader034/viewer/2022042611/586a1c191a28ab6b518b6d89/html5/thumbnails/9.jpg)
Solutions to correct topology errorsSolutions to correct topology errors
GIS software Topology correction tools/functions
ArcGIS Extend Polyline Tool, Intersect Polylines Tool, Remove Redundant NodesTool and Clean Dangles Tool in ET Geo‐toolsClean Polyline, Clean Dangling Nodes, Split Polylines(With a Layer) in ETGeo Wizards
ArcInfo Clean {Coverage}, Validate Entire Topology tool, Fix Topology Error tool
l i l i l l b k d lGRASS Cleaning tools in v.clean Toolset: break, rmdangle, snap
AutoCAD Map Creating a network topology, Editing Topologies
![Page 10: Converting a spatial network to a graph Converting a spatial network](https://reader034.vdocuments.net/reader034/viewer/2022042611/586a1c191a28ab6b518b6d89/html5/thumbnails/10.jpg)
Over correction
![Page 11: Converting a spatial network to a graph Converting a spatial network](https://reader034.vdocuments.net/reader034/viewer/2022042611/586a1c191a28ab6b518b6d89/html5/thumbnails/11.jpg)
Structure OptimizationStructure Optimization
43
2
1 2
10 98
12
14
1113
15
16
8
5 617 18 7
Pseudo-node
Multiple-edgeSelf-loop
![Page 12: Converting a spatial network to a graph Converting a spatial network](https://reader034.vdocuments.net/reader034/viewer/2022042611/586a1c191a28ab6b518b6d89/html5/thumbnails/12.jpg)
Test on Ontario Road Network dataTest on Ontario Road Network data
![Page 13: Converting a spatial network to a graph Converting a spatial network](https://reader034.vdocuments.net/reader034/viewer/2022042611/586a1c191a28ab6b518b6d89/html5/thumbnails/13.jpg)
Test on Ontario Road Network dataTest on Ontario Road Network dataComparison between original ORN and optimized graph
Data Number of nodes Number of edges
Original vector data 37178 48765
Optimized graph 25928 36375
1125030%
1230025%
![Page 14: Converting a spatial network to a graph Converting a spatial network](https://reader034.vdocuments.net/reader034/viewer/2022042611/586a1c191a28ab6b518b6d89/html5/thumbnails/14.jpg)
Integration of point data into networkIntegration of point data into network
Two guidelines:1 Find a representative node1. Find a representative node
for each point
2. Add a new edge to connect each point with the network
![Page 15: Converting a spatial network to a graph Converting a spatial network](https://reader034.vdocuments.net/reader034/viewer/2022042611/586a1c191a28ab6b518b6d89/html5/thumbnails/15.jpg)
i. M nt to
t Mapping the ne a
each
Poi
nre
st p
oint
each poiarest node
Map
ping
eth
e ne
arint toe
iii.
Mh iii. A
dd a point
wee
n ea
cst
poi
nt
new edg
and the n dge
betw
e ne
ares
ge betwee
nearest n a ne
w e
dnt
and
the
en eachnode
iv. A
dd
poi n
![Page 16: Converting a spatial network to a graph Converting a spatial network](https://reader034.vdocuments.net/reader034/viewer/2022042611/586a1c191a28ab6b518b6d89/html5/thumbnails/16.jpg)
Edge ReconstructionEdge Reconstruction
Edge splitEdge split_ iNew a A
l
Functions for recalculating attributes
_ ii
lNew a AL
Edge merge
_ max
_ mini
i
New a A
New a A
_ sum
_ meani
i
New a A
New a A
![Page 17: Converting a spatial network to a graph Converting a spatial network](https://reader034.vdocuments.net/reader034/viewer/2022042611/586a1c191a28ab6b518b6d89/html5/thumbnails/17.jpg)
R package “shp2graph”p g p g p
![Page 18: Converting a spatial network to a graph Converting a spatial network](https://reader034.vdocuments.net/reader034/viewer/2022042611/586a1c191a28ab6b518b6d89/html5/thumbnails/18.jpg)
R package “shp2graph”p g p g p
![Page 19: Converting a spatial network to a graph Converting a spatial network](https://reader034.vdocuments.net/reader034/viewer/2022042611/586a1c191a28ab6b518b6d89/html5/thumbnails/19.jpg)
After conversion you canAfter conversion, you can…
• compute the shortest paths
• visualize the graph with igraph, shp2graph,visualize the graph with igraph, shp2graph,pajek
d k l i i h i ki d f• do network analysis with various kinds ofmethods available in graph, igraph, RBGL, etc
• ……
![Page 20: Converting a spatial network to a graph Converting a spatial network](https://reader034.vdocuments.net/reader034/viewer/2022042611/586a1c191a28ab6b518b6d89/html5/thumbnails/20.jpg)
Future workFuture work
I was an R beginner when I started to developthis package, so… I make lots of mistakes!p g
• Awkward parameter settings in functions
• Poor coding style• Poor coding style
Topology correction functions will be developedin the near futurein the near future.
![Page 21: Converting a spatial network to a graph Converting a spatial network](https://reader034.vdocuments.net/reader034/viewer/2022042611/586a1c191a28ab6b518b6d89/html5/thumbnails/21.jpg)
I will keep working on this, and welcome any contribution, suggestions or comments., gg
![Page 22: Converting a spatial network to a graph Converting a spatial network](https://reader034.vdocuments.net/reader034/viewer/2022042611/586a1c191a28ab6b518b6d89/html5/thumbnails/22.jpg)
AcknowledgmentsAcknowledgments
• To Centre for Research into Statistical Methodology(CRISM) for funding me to attend this conference.
• Research presented in this paper is jointly funded bya Strategic Research Cluster grant (07/SRC/I1168) bya Strategic Research Cluster grant (07/SRC/I1168) byScience Foundation Ireland under the NationalDevelopment Plan and China Scholarship CouncilDevelopment Plan and China Scholarship Council(CSC).
![Page 23: Converting a spatial network to a graph Converting a spatial network](https://reader034.vdocuments.net/reader034/viewer/2022042611/586a1c191a28ab6b518b6d89/html5/thumbnails/23.jpg)
Any comments or questions?