November 2018
Beginner to intermediate
354 pages
6h 59m
English
Now, what if we only want the points that are outside Dhaka? That's what the gDifference() function under the rgeos package in R helps us to do. With gDifference(), we provide points first, followed by dhaka. This is very straightforward to implement:
not_dhaka = gDifference(points, dhaka)plot(map_bd, col = "gray", border = "blue", main = "All the points except Dhaka's are plotted")plot(not_dhaka, add = TRUE, pch=20, cex=0.4, col = "red")
Here, we have plotted this new SpatialLines not_dhaka on the map of Bangladesh to see whether we have been able to keep all of the points except Dhaka's (which are at the middle part of the map of Bangladesh). We'll get a result similar to the following:
It looks like there are no points ...
Read now
Unlock full access