makeBallIcon: Create an icon image file

Description Usage Arguments Value Author(s) See Also Examples

Description

These functions are used to create icon images for placing on Google Earth (i.e. an icon for a place mark on the earth).

Usage

1
2
3
4
makeBallIcon(col = "red", file = "/tmp/ball.png", width = 40, height = width, radius = 0.43)
makeRectIcon(col = "red", file = "/tmp/rect.png", width = 40, height = width, radius = 1)
makePchIcon(pch = "red", col = "red", file = sprintf("pch_%s.png", as.character(pch)),
              cex = 4, width = 40, height = width, radius = 1)

Arguments

col

a color used to control the color of the shape or character being drawn, passed to a call to symbols, points or text.

file

the name of the PNG file to create

width,height

the width and height of the image to create, in pixels

radius

the size of the symbol to draw

pch

the plotting character to draw in the image

cex

character expansion factor passed on to text.

Value

a character string giving the name of the generated PNG file.

Author(s)

Duncan Temple Lang

See Also

kml, kmlPoints and the styles parameter.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
  makeBallIcon("red")
  makePchIcon(17, "#0000FF")

  mapply(makeRectIcon, heat.colors(7), sprintf("heat_%d.png", 1:7))

  data(quakes)

  mag = factor(as.integer(quakes$magnitude))
  icons = mapply(makeBallIcon, heat.colors(length(levels(mag))), sprintf("heat_%d.png", 1:length(levels(mag))))
  styles = lapply(icons, function(x) list(IconStyle = list(scale = ".5", Icon = c(href = x))))
  names(styles) = gsub(".png", "", icons)

  doc = kml(~ longitude + latitude, quakes, styles = styles,  col = names(styles)[mag])

duncantl/RKML documentation built on May 15, 2019, 5:31 p.m.