TextOnStaticMap function

plots text on map

plots text on map

TextOnStaticMap draws the strings given in the vector labels at the coordinates given by x and y on a map. y may be missing since xy.coords(x,y) is used for construction of the coordinates.

TextOnStaticMap(MyMap, lat, lon, labels = seq_along(lat), TrueProj = TRUE, FUN = text, add = FALSE, verbose = 0, ...)

Arguments

  • MyMap: map image returned from e.g. GetMap()
  • lat: latitude where to put text.
  • lon: longitude where to put text.
  • labels: a character vector or expression specifying the text to be written. An attempt is made to coerce other language objects (names and calls) to expressions, and vectors and other classed objects to character vectors by as.character . If labels is longer than x and y, the coordinates are recycled to the length of labels.
  • TrueProj: set to FALSE if you are willing to accept some degree of inaccuracy in the mapping. In that case, the coordinates of the image are in lat/lon and the user can simply overly points/lines/axis without worrying about projections
  • FUN: overlay function, typical choice would be text
  • add: start a new plot or add to an existing
  • verbose: level of verbosity
  • ...: further arguments to be passed to FUN

Returns

return value of FUN

Author(s)

Markus Loecher

Examples

if (0) { lat = c(40.702147,40.718217,40.711614); lon = c(-74.012318,-74.015794,-73.998284); center = c(mean(lat), mean(lon)); zoom <- min(MaxZoom(range(lat), range(lon))); MyMap <- GetMap(center=center, zoom=zoom,markers = paste0("&markers=color:blue|label:S|", "40.702147,-74.015794&markers=color:green|label:G|40.711614,-74.012318&markers=", "color:red|color:red|label:C|40.718217,-73.998284"), destfile = "MyTile1.png"); TextOnStaticMap(MyMap, lat=40.711614,lon=-74.012318, "Some Text", cex=2, col = 'red') }