On 29.01.2009, at 16:49, Jonathan Callahan wrote:
Is anyone aware of an even more simplified version of the data that
went
into creating TM_WORLD_BORDERS_SIMPL-0.2.RData so that we might have
TM_WORLD_BORDERS_LOWRES.RData for use cases like my own.
A very quick solution would be to filter out all irrelevant small
polygons (islands).
[to reduce the number of polygon points would lead to very unshaped
boundaries, I mean]
What is an irrelevant polygon? My first approach is if a country
consists of more than 2 polygons then draw only those which are
greater than a given area let's say 0.1 .
To achieve that without recreating the entire SpatialPolygonsDataFrame
one could simply change the plotOrder of each PolygonsList and save it.
Like that quick&dirty script:
library("maptools")
load(url("http://spatial.nhh.no/R/etc/
TM_WORLD_BORDERS_SIMPL-0.2.RData"))
wrld_simpl <- wrld_simpl[wrld_simpl$NAME != "Antarctica",]
for (i in (1:length(wrld_si...@polygons))) {
polyCnt <- length(wrld_si...@polygons[[i]]@Polygons)
if(polyCnt > 2) {
pO <- sapply(wrld_si...@polygons[[i]]@Polygons, function(x)
{slot(x,'area')>0.1})
new_pO <- pO[ wrld_si...@polygons[[i]]@plotOrder ]
wrld_si...@polygons[[i]]@plotOrder <-
wrld_si...@polygons[[i]]@plotOrder[ new_pO ]
}
}
save(wrld_simpl,'SIMPLEMAP.Rdata')
--Hans
_______________________________________________
R-sig-Geo mailing list
[email protected]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo