R以纬度/经度(epsg 4326)绘制半径为R米的圆

R以纬度/经度(epsg 4326)绘制半径为R米的圆,r,geometry,latitude-longitude,R,Geometry,Latitude Longitude,我想在我的数据集中为大约100个点创建一个缓冲区,其长度为r,在各点之间变化(基本上是客户愿意旅行到达点/商店的第80个百分位距离) 我的数据包含以下列:lat_中心、lon_中心、radius_km 这里有一个1km的例子: Javascript与谷歌地图 var draw_circle = new google.maps.Circle({ center: point_i, radius: 1000, strokeColor: col,

我想在我的数据集中为大约100个点创建一个缓冲区,其长度为r,在各点之间变化(基本上是客户愿意旅行到达点/商店的第80个百分位距离)

我的数据包含以下列:lat_中心、lon_中心、radius_km

这里有一个1km的例子:

Javascript与谷歌地图

   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
    });
这将在左侧绘制图像:

但是,下面的R尝试在右侧绘制了一个圆圈(您可以看到它更小):

库(dismo)

emory我编写了googleway包来访问GoogleMapsJavaScript API,因此您可以复制您的图像

要使其正常工作,您需要一个有效的Google API密钥

library(googleway)

## your api key 
map_key <- "your_api_key_goes_here"

d <- data.frame(lat = c(51.51594), lon = c(-0.08248))

google_map(data = d, key = map_key, height = 800) %>%
    add_markers() %>%
    add_circles(radius = 1000)
library(googleway)
##您的api密钥
映射键%
添加_圆(半径=1000)

ggplot(data=df,aes(x,y,size=r)+geom_point()
?其中
r
df
中指定半径的一列?@Phil谢谢!r会是什么单位?@Phil plot单位可能与数据单位不同(特别是在处理地图投影时)。可能重复:(第二个答案看起来很有希望)和(几个答案)。这个问题可以用一点R代码来改进,即一个最小的工作示例。同样在GIS堆栈交换上。看起来非常有希望。可能是重复的
library(googleway)

## your api key 
map_key <- "your_api_key_goes_here"

d <- data.frame(lat = c(51.51594), lon = c(-0.08248))

google_map(data = d, key = map_key, height = 800) %>%
    add_markers() %>%
    add_circles(radius = 1000)