
Last chance! 50% off unlimited learning
Sale ends in
mapshape(shp, percent = 10, ms_options = "", dsn = "mapshape", silent = FALSE)
no-topology
(a flag) and snap-interval=1
(a key value pair).
See the mapshaper documentation for details:
https://github.com/mbloch/mapshaper/wiki/Command-Reference.The percent argument refers to the percentage of removable points to retain.
So percent = 1
is a very aggressive simplication, saving a huge amount of
hard-disk space.
system
.
mapshape
writes new a file to disk.
Thanks to Richard and Adrian Ellison for demonstrating this in R.gSimplify
## Not run:
# data(routes_fast)
# shp <- routes_fast[1,]
# rfs10 <- mapshape(shp)
# rfs5 <- mapshape(shp, percent = 5)
# rfs1 <- mapshape(shp, percent = 1)
# plot(shp)
# plot(rfs10, add = TRUE, col ="red")
# plot(rfs5, add = TRUE, col ="blue")
# plot(rfs1, add = TRUE, col = "grey")
# # snap the lines to the nearest interval
# rfs_int <- mapshape(shp, ms_options = "snap-interval=0.001")
# plot(shp)
# plot(rfs_int, add = TRUE)
# ## End(Not run)
Run the code above in your browser using DataLab