I would like to create a buffer for around 100 points in my data-set which is of length r and varies between the points (basically it's an 80th percentile distance that customers are willing to travel to get to the point/shop).
My data contains the following columns: lat_centre, lon_centre, radius_km
Here is a 1km example:
Javascript with Google Maps.
var draw_circle = new google.maps.Circle({
center: point_i,
radius: 1000,
strokeColor: col,
strokeOpacity: 0.15,
strokeWeight: 2,
fillColor: col,
fillOpacity: 0.15,
map: map
});
Which draws the image on the left:
However, the following R-attempt draws the circle on the right (which you can see is smaller):
library(dismo)
emory <- gmap("Bishopsgate, London", zoom = 14, scale = 2)
d <- data.frame(lat = c(51.51594), lon = c(-0.08248))
coordinates(d) <- ~ lon + lat
projection(d) <- "+init=epsg:4326"
mm <- "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs"
d_mrc <- spTransform(d, CRS = CRS(mm))
# Buffer creation
d_mrc_bff <- gBuffer(d_mrc, width = 1000)
library(scales) # for `alpha()` function
plot(emory)
plot(d_mrc_bff, col = alpha("red", .35), add = TRUE)
points(d_mrc, cex = 2, pch = 20)