Wikisym 2012 Demo
Polygons on Google Maps
This example plots municipalities of Finland on Google Maps using data from National Land Survey of Finland.
This example plots municipalities of Finland on Google Maps using data from National Land Survey of Finland.
library(OpasnetBaseUtils) library(sorvi) library(rgdal) data(MML) shp <- MML[["1_milj_Shape_etrs_shape"]][["kunta1_p"]] epsg4326String <- CRS("+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs") proj4string(shp)<-("+init=epsg:3047") shp2<-spTransform(shp,epsg4326String) out<-sapply(slot(shp2,"polygons"),function(x){kmlPolygon(x,name="nimi",col='#df0000aa',lwd=1,border='black',description="selite") }) data<-paste( paste(kmlPolygon(kmlname="This will be layer name", kmldescription="<i>More info about layer here</i>")$header, collapse="\n"), paste(unlist(out["style",]), collapse="\n"), paste(unlist(out["content",]), collapse="\n"), paste(kmlPolygon()$footer, collapse="\n"), sep='' ) |