I'd like to create a map with points displayed by a custom image.
# Map with this data http://biogeo.ucdavis.edu/data/gadm2.8/rds/DEU_adm0.rds
map <- readRDS((".../DEU_adm0.rds")
map.f <- fortify(map)
# Coordinates
dat <- structure(list(Lat = c(53.0024118, 52.2263017), Lon = c(7.2665689,
10.7678071)), .Names = c("Lat", "Lon"), row.names = 1:2, class = "data.frame")
# Custom Image
img <- readPNG(system.file("img", "Rlogo.png", package="png"))
I've tried the code posted in this answer:
ggplot(map.f) +
geom_polygon(aes(x = long, y = lat, group = group),
fill = "white", colour = "black") +
coord_map() +
mapply(function(xx, yy)
annotation_raster(img, xmin=xx-1, xmax=xx+1, ymin=yy-0.2, ymax=yy+0.2),
dat$Lon, dat$Lat)
However, I get the following error:
annotation_raster only works with Cartesian coordinates
What can I do instead?