Next Article in Journal
An Object-Based Image Analysis Workflow for Monitoring Shallow-Water Aquatic Vegetation in Multispectral Drone Imagery
Next Article in Special Issue
An Analysis of the Evolution, Completeness and Spatial Patterns of OpenStreetMap Building Data in China
Previous Article in Journal
Optimized Location-Allocation of Earthquake Relief Centers Using PSO and ACO, Complemented by GIS, Clustering, and TOPSIS
Previous Article in Special Issue
HidroMap: A New Tool for Irrigation Monitoring and Management Using Free Satellite Imagery
Article Menu
Issue 8 (August) cover image

Export Article

Open AccessArticle

Shp2graph: Tools to Convert a Spatial Network into an Igraph Graph in R

School of Remote Sensing and Information Engineering, Wuhan University, 129 Luoyu Road, Wuhan 430079, China
State Key Laboratory of Information Engineering in Surveying, Mapping and Remote Sensing, Wuhan University, 129 Luoyu Road, Wuhan 430079, China
Institute of Aviation Safety, China Academy of Civil Aviation Science and Technology, Beijing 100028, China
Sustainable Agricultural Sciences, Rothamsted Research, North Wyke, Okehampton, Devon EX20 2SB, UK
National Centre for Geocomputation, Maynooth University, Maynooth, County Kildare, Ireland
Authors to whom correspondence should be addressed.
ISPRS Int. J. Geo-Inf. 2018, 7(8), 293;
Received: 4 June 2018 / Revised: 29 June 2018 / Accepted: 19 July 2018 / Published: 24 July 2018
(This article belongs to the Special Issue Free and Open Source Tools for Geospatial Analysis and Mapping)
PDF [3452 KB, uploaded 24 July 2018]


In this study, we introduce the R package shp2graph, which provides tools to convert a spatial network into an ‘igraph’ graph of the igraphR package. This conversion greatly empowers a spatial network study, as the vast array of graph analytical tools provided in igraph are then readily available to the network analysis, together with the inherent advantages of being within the R statistical computing environment and its vast array of statistical functions. Through three urban road network case studies, the calculation of road network distances with shp2graph and with igraph is demonstrated through four key stages: (i) confirming the connectivity of a spatial network; (ii) integrating points/locations with a network; (iii) converting a network into a graph; and (iv) calculating network distances (and travel times). Throughout, the required R commands are given to provide a useful tutorial on the use of shp2graph. View Full-Text
Keywords: R software; igraph; graph data model; network distance; network analysis R software; igraph; graph data model; network distance; network analysis

Figure 1

This is an open access article distributed under the Creative Commons Attribution License which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited (CC BY 4.0).

Share & Cite This Article

MDPI and ACS Style

Lu, B.; Sun, H.; Harris, P.; Xu, M.; Charlton, M. Shp2graph: Tools to Convert a Spatial Network into an Igraph Graph in R. ISPRS Int. J. Geo-Inf. 2018, 7, 293.

Show more citation formats Show less citations formats

Note that from the first issue of 2016, MDPI journals use article numbers instead of page numbers. See further details here.

Related Articles

Article Metrics

Article Access Statistics



[Return to top]
ISPRS Int. J. Geo-Inf. EISSN 2220-9964 Published by MDPI AG, Basel, Switzerland RSS E-Mail Table of Contents Alert
Back to Top