Running examples in ‘plotKML-Ex.R’ failed
The error most likely occurred in:

> ### Name: plotKML-method
> ### Title: Methods for plotting results of spatial analysis in Google Earth
> ### Aliases: plotKML-method plotKML plotKML,SpatialPointsDataFrame-method
> ###   plotKML,SpatialLinesDataFrame-method
> ###   plotKML,SpatialPolygonsDataFrame-method
> ###   plotKML,SoilProfileCollection-method
> ###   plotKML,SpatialGridDataFrame-method
> ###   plotKML,SpatialPixelsDataFrame-method plotKML,RasterLayer-method
> ###   plotKML,SpatialPhotoOverlay-method plotKML,STIDF-method
> ###   plotKML,STFDF-method plotKML,STSDF-method plotKML,STTDF-method
> ###   plotKML,SpatialPredictions-method
> ###   plotKML,RasterBrickSimulations-method
> ###   plotKML,SpatialVectorsSimulations-method
> ###   plotKML,SpatialMaxEntOutput-method
> ###   plotKML,RasterBrickTimeSeries-method
> ###   plotKML,SpatialSamplingPattern-method plotKML,list-method
> ### Keywords: spatial methods
> 
> ### ** Examples
> 
> plotKML.env(kmz = FALSE)
$colour_scale_numeric
[1] "#2C7BB6" "#ABD9E9" "#FFFFBF" "#FDAE61" "#D7191C"

$colour_scale_factor
[1] "#E41A1C" "#377EB8" "#4DAF4A" "#984EA3" "#FF7F00" "#FFFF33" "#A65628"
[8] "#F781BF" "#999999"

$colour_scale_svar
[1] "#FEEDDE" "#FDBE85" "#FD8D3C" "#E6550D" "#A63603"

$ref_CRS
[1] "+init=epsg:4326 +proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0"

$NAflag
[1] -99999

$icon
[1] "icon3.png"

$LabelScale
[1] 0.5

$size_range
[1] 0.25 2.50

$license_url
[1] "http://creativecommons.org/licenses/by/3.0/"

$metadata_sel
 [1] "idinfo.citation.citeinfo.title"                                       
 [2] "idinfo.descript.abstract"                                             
 [3] "spdoinfo.ptvctinf.sdtsterm.ptvctcnt"                                  
 [4] "idinfo.timeperd.timeinfo.rngdates.begdate"                            
 [5] "idinfo.timeperd.timeinfo.rngdates.enddate"                            
 [6] "distinfo.stdorder.digform.digtopt.onlinopt.computer.networka.networkr"
 [7] "idinfo.citation.citeinfo.othercit"                                    
 [8] "idinfo.citation.citeinfo.onlink"                                      
 [9] "idinfo.datacred"                                                      
[10] "distinfo.distrib.cntinfo.cntorgp.cntorg"                              
[11] "distinfo.stdorder.digform.digtinfo.formcont"                          
[12] "idinfo.native"                                                        

$kmz
[1] FALSE

$kml_xsd
[1] "http://schemas.opengis.net/kml/2.2.0/ogckml22.xsd"

$kml_url
[1] "http://www.opengis.net/kml/2.2/"

$kml_gx
[1] "http://www.google.com/kml/ext/2.2"

$gpx_xsd
[1] "http://www.topografix.com/GPX/1/1/gpx.xsd"

$fgdc_xsd
[1] "http://fgdcxml.sourceforge.net/schema/fgdc-std-012-2002/fgdc-std-012-2002.xsd"

$inspire_xsd
[1] "http://inspire.ec.europa.eu/schemas/common/1.0/common.xsd"

$convert
[1] ""

$gdalwarp
[1] ""

$gdal_translate
[1] ""

$python
[1] ""

$home_url
[1] "http://plotkml.r-forge.r-project.org/"

> ## -------------- SpatialPointsDataFrame --------- ##
> library(sp)
> library(rgdal)
rgdal: version: 1.5-23, (SVN revision 1121)
Geospatial Data Abstraction Library extensions to R successfully loaded
Loaded GDAL runtime: GDAL 2.2.4, released 2018/03/19
Path to GDAL shared files: /usr/local/share/gdal
GDAL binary built with GEOS: TRUE 
Loaded PROJ runtime: Rel. 5.2.0, September 15th, 2018, [PJ_VERSION: 520]
Path to PROJ shared files: (autodetected)
Linking to sp version:1.4-5
> data(eberg)
> coordinates(eberg) <- ~X+Y
> proj4string(eberg) <- CRS("+init=epsg:31467")
> ## subset to 20 percent:
> eberg <- eberg[runif(nrow(eberg))<.1,]
> ## Not run: 
> ##D ## bubble type plot:
> ##D plotKML(eberg["CLYMHT_A"])
> ##D plotKML(eberg["CLYMHT_A"], colour_scale=rep("#FFFF00", 2), points_names="")
> ## End(Not run)
> ## plot points with a legend:
> shape = "http://maps.google.com/mapfiles/kml/pal2/icon18.png" 
> kml.file = paste0(tempdir(), "/eberg_CLYMHT_A.kml")
> leg.file = paste0(dirname(kml.file), "/kml_legend.png")
> kml_open(kml.file)
KML file opened for writing...
> kml_layer(eberg["CLYMHT_A"], colour=CLYMHT_A, z.lim=c(20,60),
+           colour_scale=SAGA_pal[[1]], shape=shape, points_names="")
Reprojecting to +init=epsg:4326 +proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0 ...
Writing to KML...
> kml_legend.bar(x=eberg$CLYMHT_A, 
+                legend.file=leg.file,
+                legend.pal=SAGA_pal[[1]], z.lim=c(20,60))
pdf 
  2 
> kml_screen(image.file=leg.file)
> kml_close(kml.file)
Closing  /tmp/RtmpYjaGZ3/working_dir/Rtmp78aymR/eberg_CLYMHT_A.kml
> 
> 
> ## -------------- SpatialLinesDataFrame --------- ##
> data(eberg_contours)
> ## Not run: 
> ##D plotKML(eberg_contours)
> ##D ## plot contour lines with actual altitudes:
> ##D plotKML(eberg_contours, colour=Z, altitude=Z)
> ## End(Not run)
> 
> ## -------------- SpatialPolygonsDataFrame --------- ##
> data(eberg_zones)
> ## Not run: 
> ##D plotKML(eberg_zones["ZONES"])
> ##D ## add altitude:
> ##D zmin = 230
> ##D plotKML(eberg_zones["ZONES"], altitude=zmin+runif(length(eberg_zones))*500)
> ## End(Not run)
> 
> ## -------------- SpatialPixelsDataFrame --------- ##
> library(rgdal)
> library(raster)
> data(eberg_grid)
> gridded(eberg_grid) <- ~x+y
> proj4string(eberg_grid) <- CRS("+init=epsg:31467")
> TWI <- reproject(eberg_grid["TWISRT6"])
Reprojecting to +init=epsg:4326 +proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0 ...
> data(SAGA_pal)
> ## Not run: 
> ##D ## set limits manually (increase resolution):
> ##D plotKML(TWI, colour_scale = SAGA_pal[[1]])
> ##D plotKML(TWI, z.lim=c(12,20), colour_scale = SAGA_pal[[1]])
> ## End(Not run)
> ## categorical data:
> eberg_grid$LNCCOR6 <- as.factor(paste(eberg_grid$LNCCOR6))
> levels(eberg_grid$LNCCOR6)
[1] "112 - Discontinuous urban fabric"   "211 - Non-irrigated arable land"   
[3] "231 - Pastures"                     "242 - Complex cultivation patterns"
[5] "311 - Broad-leaved forest"          "312 - Coniferous forest"           
[7] "313 - Mixed forest"                
> data(worldgrids_pal)
> ## attr(worldgrids_pal["corine2k"][[1]], "names")
> pal = as.character(worldgrids_pal["corine2k"][[1]][c(1,11,13,14,16,17,18)])
> LNCCOR6 <- reproject(eberg_grid["LNCCOR6"])
Reprojecting to +init=epsg:4326 +proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0 ...
> ## Not run: 
> ##D plotKML(LNCCOR6, colour_scale=pal)
> ## End(Not run)
> 
> ## -------------- SpatialPhotoOverlay --------- ##
> ## Not run: 
> ##D library(RCurl)
> ##D imagename = "Soil_monolith.jpg"
> ##D urlExists = url.exists("http://commons.wikimedia.org")
> ##D if(urlExists){
> ##D   x1 <- getWikiMedia.ImageInfo(imagename)
> ##D   sm <- spPhoto(filename = x1$url$url, exif.info = x1$metadata)
> ##D   # str(sm)
> ##D   plotKML(sm)
> ##D }
> ## End(Not run)
> 
> ## -------------- SoilProfileCollection --------- ##
> library(aqp)
This is aqp 1.27

Attaching package: ‘aqp’

The following objects are masked from ‘package:raster’:

    metadata, metadata<-

The following object is masked from ‘package:stats’:

    filter

> library(plyr)

Attaching package: ‘plyr’

The following objects are masked from ‘package:aqp’:

    mutate, summarize

> ## sample profile from Nigeria:
> lon = 3.90; lat = 7.50; id = "ISRIC:NG0017"; FAO1988 = "LXp" 
> top = c(0, 18, 36, 65, 87, 127) 
> bottom = c(18, 36, 65, 87, 127, 181)
> ORCDRC = c(18.4, 4.4, 3.6, 3.6, 3.2, 1.2)
> hue = c("7.5YR", "7.5YR", "2.5YR", "5YR", "5YR", "10YR")
> value = c(3, 4, 5, 5, 5, 7); chroma = c(2, 4, 6, 8, 4, 3)
> ## prepare a SoilProfileCollection:
> prof1 <- join(data.frame(id, top, bottom, ORCDRC, hue, value, chroma), 
+    data.frame(id, lon, lat, FAO1988), type='inner')
Joining by: id
> prof1$soil_color <- with(prof1, munsell2rgb(hue, value, chroma))
> depths(prof1) <- id ~ top + bottom
> site(prof1) <- ~ lon + lat + FAO1988 
> coordinates(prof1) <- ~ lon + lat
> proj4string(prof1) <- CRS("+proj=longlat +datum=WGS84")
> prof1
SoilProfileCollection with 1 profiles and 6 horizons
profile ID: id  |  horizon ID: hzID 
Depth range: 181 - 181 cm

----- Horizons (6 / 6 rows  |  9 / 9 columns) -----
           id hzID top bottom ORCDRC   hue value chroma soil_color
 ISRIC:NG0017    1   0     18   18.4 7.5YR     3      2  #584537FF
 ISRIC:NG0017    2  18     36    4.4 7.5YR     4      4  #7E5A3BFF
 ISRIC:NG0017    3  36     65    3.6 2.5YR     5      6  #A96C4FFF
 ISRIC:NG0017    4  65     87    3.6   5YR     5      8  #B06A32FF
 ISRIC:NG0017    5  87    127    3.2   5YR     5      4  #9A7359FF
 ISRIC:NG0017    6 127    181    1.2  10YR     7      3  #C4AC8CFF

----- Sites (1 / 1 rows  |  2 / 2 columns) -----
           id FAO1988
 ISRIC:NG0017     LXp

Spatial Data:
    min max
lon 3.9 3.9
lat 7.5 7.5
[1] "+proj=longlat +datum=WGS84 +ellps=WGS84 +towgs84=0,0,0"
> ## Not run: 
> ##D plotKML(prof1, var.name="ORCDRC", color.name="soil_color")
> ## End(Not run)
> 
> ## -------------- STIDF --------- ##
> library(sp)
> library(spacetime)
> ## daily temperatures for Croatia:
> data(HRtemp08)
> ## format the time column:
> HRtemp08$ctime <- as.POSIXct(HRtemp08$DATE, format="%Y-%m-%dT%H:%M:%SZ")
> ## create a STIDF object:
> sp <- SpatialPoints(HRtemp08[,c("Lon","Lat")])
> proj4string(sp) <- CRS("+proj=longlat +datum=WGS84")
> HRtemp08.st <- STIDF(sp, time = HRtemp08$ctime, data = HRtemp08[,c("NAME","TEMP")])
> ## subset to first 500 records:
> HRtemp08_jan <- HRtemp08.st[1:500]
> str(HRtemp08_jan)
Formal class 'STIDF' [package "spacetime"] with 4 slots
  ..@ data   :'data.frame':	500 obs. of  2 variables:
  .. ..$ NAME: Factor w/ 158 levels "<c3><88>akovec",..: 17 50 81 83 84 82 85 86 88 89 ...
  .. ..$ TEMP: num [1:500] -3.5 -1.25 -4 NA 2.58 ...
  ..@ sp     :Formal class 'SpatialPoints' [package "sp"] with 3 slots
  .. .. ..@ coords     : num [1:500, 1:2] 17.2 15.6 17.4 15.5 13.6 ...
  .. .. .. ..- attr(*, "dimnames")=List of 2
  .. .. .. .. ..$ : NULL
  .. .. .. .. ..$ : chr [1:2] "Lon" "Lat"
  .. .. ..@ bbox       : num [1:2, 1:2] 13.6 42.4 19.4 46.4
  .. .. .. ..- attr(*, "dimnames")=List of 2
  .. .. .. .. ..$ : chr [1:2] "Lon" "Lat"
  .. .. .. .. ..$ : chr [1:2] "min" "max"
  .. .. ..@ proj4string:Formal class 'CRS' [package "sp"] with 1 slot
  .. .. .. .. ..@ projargs: chr "+proj=longlat +datum=WGS84 +ellps=WGS84 +towgs84=0,0,0"
  ..@ time   :An ‘xts’ object on 2008-01-01/2008-01-04 containing:
  Data: int [1:500, 1] 298 433 916 1198 1683 2010 2526 2932 2966 3327 ...
 - attr(*, "dimnames")=List of 2
  ..$ : NULL
  ..$ : chr "timeIndex"
  Indexed by objects of class: [POSIXct,POSIXt] TZ: GB
  xts Attributes:  
 NULL
  ..@ endTime: POSIXct[1:500], format: "2008-01-01" "2008-01-01" ...
> ## Not run: 
> ##D plotKML(HRtemp08_jan[,,"TEMP"], LabelScale = .4)
> ## End(Not run)
> 
> ## foot-and-mouth disease data:
> data(fmd)
> fmd0  <- data.frame(fmd)
> coordinates(fmd0) <- c("X", "Y")
> proj4string(fmd0) <- CRS("+init=epsg:27700")
> fmd_sp <- as(fmd0, "SpatialPoints")
> dates <- as.Date("2001-02-18")+fmd0$ReportedDay
> library(spacetime)
> fmd_ST <- STIDF(fmd_sp, dates, data.frame(ReportedDay=fmd0$ReportedDay))
> data(SAGA_pal)
> ## Not run: 
> ##D plotKML(fmd_ST, colour_scale=SAGA_pal[[1]])
> ## End(Not run)
> 
> ## -------------- STFDF --------- ##
> 
> ## results of krigeST:
> library(gstat)
> library(sp)
> library(spacetime)
> library(raster)
> ## define space-time variogram
> sumMetricVgm <- vgmST("sumMetric",
+                       space=vgm( 4.4, "Lin", 196.6,  3),
+                       time =vgm( 2.2, "Lin",   1.1,  2),
+                       joint=vgm(34.6, "Exp", 136.6, 12),
+                       stAni=51.7)
> ## example from the gstat package:
> data(air)
> rural = STFDF(stations, dates, data.frame(PM10 = as.vector(air)))
> rr <- rural[,"2005-06-01/2005-06-03"]
> rr <- as(rr,"STSDF")
> x1 <- seq(from=6,to=15,by=1)
> x2 <- seq(from=48,to=55,by=1)
> DE_gridded <- SpatialPoints(cbind(rep(x1,length(x2)), rep(x2,each=length(x1))), 
+                            proj4string=CRS(proj4string(rr@sp)))
Warning in proj4string(rr@sp) :
  CRS object has comment, which is lost in output
> gridded(DE_gridded) <- TRUE
> DE_pred <- STF(sp=as(DE_gridded,"SpatialPoints"), time=rr@time)
> DE_kriged <- krigeST(PM10~1, data=rr, newdata=DE_pred,
+                      modelList=sumMetricVgm)
please verify that the CRSs of data and newdata are identical, or transform them first to make them identical
Warning in krigeST(PM10 ~ 1, data = rr, newdata = DE_pred, modelList = sumMetricVgm) :
  The spatio-temporal variogram model does not carry the strongly recommended attribute 'temporal unit'.
 The unit 'days' has been assumed. krigeST could not check whether the temporal distances between locations and in the variogram coincide.
Error in spDists(x@sp, y@sp) : identicalCRS(x, y) is not TRUE
Calls: krigeST ... krigeST.df -> covfn.ST -> covSumMetric -> spDists -> stopifnot
Execution halted