I'm unable to simplify a shapefile in R
Shapefile from here: https://geoportal.statistics.gov.uk/Docs/Boundaries/Local_authority_district_(GB)_2014_Boundaries_(Generalised_Clipped).zip
library(tmap)
library(maptools)
library(ggmap)
England <- readOGR(dsn = "...")
#works fine
print(qtm(England, "LAD14CD", borders = NA, fill.title = "A-Level" ))
# simplify the polygons
England<-gSimplify(England,tol=0.01, topologyPreserve=TRUE)
print(qtm(England, "LAD14CD", borders = NA, fill.title = "A-Level" ))
Gives an error of:
Error in process_fill(data, g$tm_fill, gborders, gt, gf, z = z + which(plot.order == :
Fill argument neither colors nor valid variable name(s)
If you look at the UK dataobject you can see that it has changed from a Large Spatial polygonDataFrame to Large Spatial Polygons and dropped the @data
Instead, if you try to only simplify the polygons in the Shapefile:
England@polygons<-gSimplify(England@polygons,tol=0.01, topologyPreserve=TRUE)
It says that:
Error in gSimplify(England@polygons, tol = 0.01, topologyPreserve = TRUE) :
cannot get a slot ("proj4string") from an object of type "list"
How can I simplify the polygons from a shapefile?
qtmcome from? - Spacedmanlibrarycalls to your questions when needed to run examples. - Spacedman