[R-sig-Geo] plotKML organizing folders

Anthony Fischbach afischbach at usgs.gov
Fri Oct 3 21:32:16 CEST 2014


This is very helpful having the ability to specify folder names.
It would be helpful to have this facility for all the spatial classes
handled by plotKML.

Now I wish to apply differing sizes for points based on their properties.
This should be possibly by specifying the size parameter.  However this
appears to fail when applied to individual folders within a multi-part kml.  
The example below fails to create the unique points sizes.

## KML_Folder_problem.r
require(plotKML)
require(sp)
setwd('D:/Walrus/Haulout_Locations/rCode')  ## house keeping specify working
directory
data(bigfoot) ## Load a data frame with point features
bigfootA<-head(bigfoot)
bigfootB<-tail(bigfoot)
coordinates(bigfootA)<-c('Lon','Lat') ## Cast a spatial points dataframe
proj4string(bigfootA)<-CRS("+proj=longlat +ellps=WGS84 +datum=WGS84
+no_defs")  ## assign a coordinate reference system
bigfootA at data$SymbolSize<-3  ## Assign the symbol size to a variable 
coordinates(bigfootB)<-c('Lon','Lat') ## Cast a spatial points dataframe
proj4string(bigfootB)<-CRS("+proj=longlat +ellps=WGS84 +datum=WGS84
+no_defs")  ## assign a coordinate reference system
bigfootB at data$SymbolSize<-1  ## Assign the symbol size to a variable 

kml_open(file.name='BigWithFolders.kml', folder.name = 'Big Foot',
kml_visibility=TRUE )
	## Build the points by each class

		kml_layer.SpatialPoints(obj=bigfootA, subfolder.name= 'A', 
			points_names=bigfootA at data$NAMES, size=SymbolSize, ## specify the symbol
size
			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, subfolder.name= 'B',
			points_names=bigfootB at data$NAMES, size=SymbolSize,
			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')
#

The resultant kml has all points specified with a symbol size of 1.5.



-----
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-tp7587119p7587229.html
Sent from the R-sig-geo mailing list archive at Nabble.com.



More information about the R-sig-Geo mailing list