Skip to content

plotKML and time stamp

7 messages · Edzer Pebesma, Tomislav Hengl, Struve,Juliane

#
On 10/01/2012 05:47 PM, Struve,Juliane wrote:
You can create an STI object with just the space-time points, leaving
out the df, but plotKML does not (yet) have a method to display STI
objects -- it wants STIDF with attributes. To work around this, you
could try giving the attribute a constant value, if you don't have sth
that varies.

  
    
#
Hello,

The attribute I am interested in is a site number. When I use the site number as attribute data the size of the bubble is proportional to the number, which does not really make sense given that the data are just site numbers. But when I make it a constant I lose the site number information. How can I get a plot that shows all the locations with the same size bubble but displays also the site number information, say like a label ? It seems that the attribute data need to be numeric.

Thank you for your time,

Juliane

-----Original Message-----
From: Edzer Pebesma [mailto:edzer.pebesma at uni-muenster.de] 
Sent: Monday, October 01, 2012 4:55 PM
To: Struve,Juliane; r-sig-geo at r-project.org
Subject: Re: [R-sig-Geo] plotKML and time stamp
On 10/01/2012 05:47 PM, Struve,Juliane wrote:
You can create an STI object with just the space-time points, leaving out the df, but plotKML does not (yet) have a method to display STI objects -- it wants STIDF with attributes. To work around this, you could try giving the attribute a constant value, if you don't have sth that varies.
--
Edzer Pebesma
Institute for Geoinformatics (ifgi), University of M?nster Weseler Stra?e 253, 48151 M?nster, Germany. Phone: +49 251 8333081, Fax: +49 251 8339763  http://ifgi.uni-muenster.de
http://www.52north.org/geostatistics      e.pebesma at wwu.de
#
try:

 > library(plotKML)
 > data(HRtemp08)
# format the time column:
 > HRtemp08$ctime <- as.POSIXct(HRtemp08$DATE, format="%Y-%m-%dT%H:%M:%SZ")
## Not run: # create a STIDF object:
 > library(spacetime)
 > 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")])
# write to a KML file:
 > HRtemp08_jan <- HRtemp08.st[1:500]
 > shape = "http://maps.google.com/mapfiles/kml/pal2/icon18.png"
 > kml(HRtemp08_jan, dtime = 24*3600, labels = TEMP, shape = shape, 
colour = TEMP, colour_scale=rep("#FFFF00", 2), kmz = TRUE)

See also:

http://plotkml.r-forge.r-project.org/tutorial.php#sp_classes
http://plotkml.r-forge.r-project.org/layer.STIDF.html

Note that, when using 'kml' method, you need to open the KML file yourself.

T. Hengl
On 02/10/2012 15:01, Struve,Juliane wrote:
1 day later
#
Hello,

Thanks a lot for replying. I can't run this script, the last line gives me an error:

KML file header opened for parsing...
Parsing to KML...
Closing  HRtemp08_jan.kml
Error in kml_compress(file.name = file.name) : 
  KMZ generation failed. Wrong command passed to 'zip = ... option'.

What do I need to change ?

Regards,

Juliane 

sessionInfo()

R version 2.15.0 (2012-03-30)
Platform: i386-pc-mingw32/i386 (32-bit)

locale:
[1] LC_COLLATE=English_United States.1252 
[2] LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] splines   stats     graphics  grDevices utils     datasets  methods  
[8] base     

other attached packages:
 [1] plotKML_0.2-5      dismo_0.7-23       scales_0.2.2       aqp_1.2-7         
 [5] gstat_1.0-14       spacetime_0.8-0    xts_0.8-6          zoo_1.7-7         
 [9] Hmisc_3.9-3        survival_2.36-12   RColorBrewer_1.0-5 stringr_0.6.1     
[13] colorRamps_2.3     plotrix_3.4-5      colorspace_1.1-1   plyr_1.7.1        
[17] raster_2.0-12      pixmap_0.4-11      XML_3.9-4.1        rgdal_0.7-19      
[21] sp_0.9-99         

loaded via a namespace (and not attached):
[1] cluster_1.14.2  dichromat_1.2-4 grid_2.15.0     labeling_0.1   
[5] lattice_0.20-6  munsell_0.4     reshape_0.8.4   tools_2.15.0   


-----Original Message-----
From: Tomislav Hengl [mailto:hengl at spatial-analyst.net] 
Sent: Wednesday, October 03, 2012 7:41 AM
To: Struve,Juliane
Cc: Edzer Pebesma; r-sig-geo at r-project.org
Subject: Re: [R-sig-Geo] plotKML and time stamp


try:

 > library(plotKML)
 > data(HRtemp08)
# format the time column:
 > HRtemp08$ctime <- as.POSIXct(HRtemp08$DATE, format="%Y-%m-%dT%H:%M:%SZ")
## Not run: # create a STIDF object:
 > library(spacetime)
 > 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")])
# write to a KML file:
 > HRtemp08_jan <- HRtemp08.st[1:500]
 > shape = "http://maps.google.com/mapfiles/kml/pal2/icon18.png"
 > kml(HRtemp08_jan, dtime = 24*3600, labels = TEMP, shape = shape, 
colour = TEMP, colour_scale=rep("#FFFF00", 2), kmz = TRUE)

See also:

http://plotkml.r-forge.r-project.org/tutorial.php#sp_classes
http://plotkml.r-forge.r-project.org/layer.STIDF.html

Note that, when using 'kml' method, you need to open the KML file yourself.

T. Hengl
On 02/10/2012 15:01, Struve,Juliane wrote:
#
Apoplogies for the previous post. I had not seen your statement 
" Note that, when using 'kml' method, you need to open the KML file yourself".
The example shows exactly what I am looking for.

Thanks for help.

Juliane

-----Original Message-----
From: r-sig-geo-bounces at r-project.org [mailto:r-sig-geo-bounces at r-project.org] On Behalf Of Struve,Juliane
Sent: Thursday, October 04, 2012 9:01 AM
To: Tomislav Hengl
Cc: r-sig-geo at r-project.org
Subject: Re: [R-sig-Geo] plotKML and time stamp

Hello,

Thanks a lot for replying. I can't run this script, the last line gives me an error:

KML file header opened for parsing...
Parsing to KML...
Closing  HRtemp08_jan.kml
Error in kml_compress(file.name = file.name) : 
  KMZ generation failed. Wrong command passed to 'zip = ... option'.

What do I need to change ?

Regards,

Juliane 

sessionInfo()

R version 2.15.0 (2012-03-30)
Platform: i386-pc-mingw32/i386 (32-bit)

locale:
[1] LC_COLLATE=English_United States.1252 
[2] LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] splines   stats     graphics  grDevices utils     datasets  methods  
[8] base     

other attached packages:
 [1] plotKML_0.2-5      dismo_0.7-23       scales_0.2.2       aqp_1.2-7         
 [5] gstat_1.0-14       spacetime_0.8-0    xts_0.8-6          zoo_1.7-7         
 [9] Hmisc_3.9-3        survival_2.36-12   RColorBrewer_1.0-5 stringr_0.6.1     
[13] colorRamps_2.3     plotrix_3.4-5      colorspace_1.1-1   plyr_1.7.1        
[17] raster_2.0-12      pixmap_0.4-11      XML_3.9-4.1        rgdal_0.7-19      
[21] sp_0.9-99         

loaded via a namespace (and not attached):
[1] cluster_1.14.2  dichromat_1.2-4 grid_2.15.0     labeling_0.1   
[5] lattice_0.20-6  munsell_0.4     reshape_0.8.4   tools_2.15.0   


-----Original Message-----
From: Tomislav Hengl [mailto:hengl at spatial-analyst.net] 
Sent: Wednesday, October 03, 2012 7:41 AM
To: Struve,Juliane
Cc: Edzer Pebesma; r-sig-geo at r-project.org
Subject: Re: [R-sig-Geo] plotKML and time stamp


try:

 > library(plotKML)
 > data(HRtemp08)
# format the time column:
 > HRtemp08$ctime <- as.POSIXct(HRtemp08$DATE, format="%Y-%m-%dT%H:%M:%SZ")
## Not run: # create a STIDF object:
 > library(spacetime)
 > 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")])
# write to a KML file:
 > HRtemp08_jan <- HRtemp08.st[1:500]
 > shape = "http://maps.google.com/mapfiles/kml/pal2/icon18.png"
 > kml(HRtemp08_jan, dtime = 24*3600, labels = TEMP, shape = shape, 
colour = TEMP, colour_scale=rep("#FFFF00", 2), kmz = TRUE)

See also:

http://plotkml.r-forge.r-project.org/tutorial.php#sp_classes
http://plotkml.r-forge.r-project.org/layer.STIDF.html

Note that, when using 'kml' method, you need to open the KML file yourself.

T. Hengl
On 02/10/2012 15:01, Struve,Juliane wrote:
_______________________________________________
R-sig-Geo mailing list
R-sig-Geo at r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
#
On 04/10/2012 15:00, Struve,Juliane wrote:
kmz = FALSE

Looks like your 'system' has no zip option. See:

 > Sys.getenv("R_ZIPCMD", "zip")

https://r-forge.r-project.org/scm/viewvc.php/pkg/R/kml_compress.R?view=markup&root=plotkml
6 days later
#
Good afternoon,

If kml() cannot find the zip utility on my system does this mean I need to "specify it manually using the 'zip = ...' argument.") ? 

What is it that kml() needs here ?

Sys.getenv("R_ZIPCMD", "zip") yields 
"zip"

Apologies, I am only just starting to use plotKML and do not  know how to interpret this output.
Regards,

Juliane 

Thanks a lot,

Juliane

-----Original Message-----
From: Tomislav Hengl [mailto:hengl at spatial-analyst.net] 
Sent: Friday, October 05, 2012 4:31 AM
To: Struve,Juliane
Cc: Edzer Pebesma; r-sig-geo at r-project.org
Subject: Re: [R-sig-Geo] plotKML and time stamp
On 04/10/2012 15:00, Struve,Juliane wrote:
kmz = FALSE

Looks like your 'system' has no zip option. See:

 > Sys.getenv("R_ZIPCMD", "zip")

https://r-forge.r-project.org/scm/viewvc.php/pkg/R/kml_compress.R?view=markup&root=plotkml