[R-sig-Geo] plotKML organizing folders

Tomislav Hengl hengl at spatial-analyst.net
Wed Sep 17 12:27:37 CEST 2014


I've added an extra argument called "subfolder.name" 
(http://plotkml.r-forge.r-project.org/layer.SpatialPoints.html) so you 
can rename your sub-folders e.g.:

library(plotKML)
library(sp)
demo(meuse, echo=FALSE)
kml(meuse, colour=zinc, subfolder.name="Zinc in ppm")
system("open meuse.kml")

To install plotKML v0.4-6 please use:

install.packages("plotKML", repos="http://R-Forge.R-project.org", 
type="source")

HTH,

T. Hengl

On 12-9-2014 20:14, Anthony Fischbach wrote:
> I wish to allow users of my kml to select specific classes of entities by
> folders within the virtual globe display.
> For example (using the standard plotKML dataset) I wish to allow users to
> select 'class A' and 'class B' bigfoot sightings by selecting folders that
> have intuitive names.
>
> ## Toy example:
> require(plotKML)
> require(sp)
> data(bigfoot) ## Load standard dataframe
> bigfootA<-head(bigfoot) ## grab the top of the dataframe, which has class A
> sightings
> bigfootB<-tail(bigfoot)  ## grab the bottom of the dataframe, which has
> class B sightings
> ## cast both dataframes into spatialPointsDataFrames with defined coordinate
> reference systems
> coordinates(bigfootA)<-c('Lon','Lat') ## Cast as spatial points dataframe
> proj4string(bigfootA)<-CRS("+proj=longlat +ellps=WGS84 +datum=WGS84
> +no_defs")  ## assign a coordinate reference system
> coordinates(bigfootB)<-c('Lon','Lat') ## Cast as spatial points dataframe
> proj4string(bigfootB)<-CRS("+proj=longlat +ellps=WGS84 +datum=WGS84
> +no_defs")  ## assign a coordinate reference system
>
> kml_open(file.name='BigWithFolders.kml', folder.name = 'Big Foot',
> kml_visibility=TRUE )
> 	## Build the points by each class
> 		kml_layer.SpatialPoints(obj=bigfootA, points_names=bigfootA at data$NAMES,
> 			colour='green',  LabelScale=0.8,
> 			shape='http://plotkml.r-forge.r-project.org/3Dballyellow.png',
> 			alpha=0.6, balloon=TRUE) ##
> 		kml_layer.SpatialPoints(obj=bigfootB, points_names=bigfootB at data$NAMES,
> 			colour='yellow',  LabelScale=0.8,
> 			shape='http://plotkml.r-forge.r-project.org/3Dballyellow.png',
> 			alpha=0.6, balloon=TRUE) ##
> 			
> kml_close(file.name='BigWithFolders.kml')
> ### End Toy example
>
> This produces the kml with two folders, both named 'SpatialPointsDataFrame'.
> Is there a way to set the names of each subordinate folder?
>
>
>
> -----
> Tony Fischbach, Wildlife Biologist
> Walrus Research Program
> Alaska Science Center
> U.S. Geological Survey
> 4210 University Drive
> Anchorage, AK 99508-4650
>
> AFischbach at usgs.gov
> http://alaska.usgs.gov/science/biology/walrus
> --
> View this message in context: http://r-sig-geo.2731867.n2.nabble.com/plotKML-organizing-folders-tp7587119.html
> Sent from the R-sig-geo mailing list archive at Nabble.com.
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>



More information about the R-sig-Geo mailing list