1`TextOnStaticMap` <-structure(function#plots text on map 2### 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. 3( 4 MyMap, ##<< map image returned from e.g. \code{GetMap()} 5 lat, ##<< latitude where to put text. 6 lon, ##<< longitude where to put text. 7 labels = seq_along(lat), ##<< a character vector or \link{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 \link{as.character}. If labels is longer than x and y, the coordinates are recycled to the length of labels. 8 TrueProj = TRUE, ##<< 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 9 FUN = text, ##<< overlay function, typical choice would be \link{text} 10 add = FALSE, ##<< start a new plot or add to an existing 11 verbose = 0, ##<< level of verbosity 12 ... ##<< further arguments to be passed to \code{FUN} 13){ 14 15 if (TrueProj){ 16 Rcoords <- LatLon2XY.centered(MyMap,lat= lat,lon= lon); 17 } else { #no transformtion 18 Rcoords <- list(newY= lat,newX= lon); 19 } 20 21 if (!add) tmp <- PlotOnStaticMap(MyMap, TrueProj = TrueProj, verbose=verbose); 22 FUN(x=Rcoords$newX, y=Rcoords$newY, labels = labels, ...); 23### return value of \code{FUN} 24}, ex = function(){ 25 if (0) { 26 lat = c(40.702147,40.718217,40.711614); 27 lon = c(-74.012318,-74.015794,-73.998284); 28 center = c(mean(lat), mean(lon)); 29 zoom <- min(MaxZoom(range(lat), range(lon))); 30 31 32 MyMap <- GetMap(center=center, zoom=zoom,markers = paste0("&markers=color:blue|label:S|", 33 "40.702147,-74.015794&markers=color:green|label:G|40.711614,-74.012318&markers=", 34 "color:red|color:red|label:C|40.718217,-73.998284"), destfile = "MyTile1.png"); 35 TextOnStaticMap(MyMap, lat=40.711614,lon=-74.012318, "Some Text", cex=2, col = 'red') 36 37} 38}) 39 40