November 2018
Beginner to intermediate
354 pages
6h 59m
English
Lines data consists of lines and, in the sp package of R, it is stored as a SpatialLines class. If it contains attributes, it is saved as SpatialLinesDataFrames. Similarly for polygons, without attributes the class is defined as SpatialPolygons and with attributes the class is defined as SpatialPolygonsDataFrame.
We will load a shapefile consisting of lines attributes, which will be treated as a SpatialLinesDataFrames class in R. Let's load the shapefile of highways in Dhaka, Bangladesh:
# SpatialLineshighway = readOGR("F:/Hands-on Geospatial Analysis Using R and QGIS/Chapter02/Data","dhaka_gazipur")plot(highway)
This gives us the following map:
Now, we will read polygons (a map of Dhaka saved as
Read now
Unlock full access