rrgooglemaps

RgoogleMaps text not showing


I'm trying to annotate a plot made using the RgoogleMaps package, but the text isn't showing. Here is the code:

library(RgoogleMaps)
library(PBSmapping)
library(maptools)

lat <- c(6,37.5)
lon <- c(67,98)
center = c(mean(lat), mean(lon))
zoom <- 4

terrmap <- GetMap(center=center, size=c(440,440), maptype="terrain", 
zoom=zoom, path="&style=feature:all|element:labels|visibility:off", 
destfile="/home/simon/Rplots/india_terrain.png") 
png(filename="/home/simon/Rplots/india_terrain2.png", width=175, height=175, 
units="mm", pointsize=12, bg="transparent", res=240)
PlotOnStaticMap(terrmap, lat=85,lon=32.5, add=FALSE, FUN=text,labels="Bhimgodha basin")
dev.off()

Can anyone see what is going wrong?


Solution

  • Everything's working fine, you just have your latitude / longitude turned around.

    Swap lat with lon and you'll see your text

       PlotOnStaticMap(terrmap, lon=85,lat=32.5, add=FALSE, FUN=text, labels="Bhimgodha basin")
    

    As a general rule of thumb, when debugging PlotOnStaticMap: if you're not getting any errors, then the plots are probably occurring out of view. Check your coordinates and all should be well