Friday, 31 January 2020

r - ggmap: create circle symbol where radius represents distance (miles or km)



I am trying to add a circle around a given latitude and longitude point where the circle size (radius) reflects distance in miles or km.


I managed to come up with this example using ggmap, where I can add a circle. but what do I need to do to have it represent distance. I would ultimately like the bounds of the circle to represent 20 miles from the center.


Code below:


library(ggmap)
library(ggplot2)

d <- data.frame(lat=c(33.79245),
lon=c(-84.32130))

emory <- get_map("Atlanta,Georgia", zoom=12)


p <- ggmap(emory)
p <- p + geom_point(data=d, aes(x=lon, y=lat),
color="red", size=20, alpha=0.5)
p


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...