gpt4 book ai didi

Counting the number of points in the grid(计算网格中的点数)

转载 作者:bug小助手 更新时间:2023-10-25 15:26:57 24 4
gpt4 key购买 nike



library(sf)
library(sp)
library(raster)
library(ggplot2)

#map
map <- getData('GADM', country='KOR', level=1)
map <- st_as_sf(map)
grid <- map %>%
st_make_grid(cellsize = 0.1) %>%
st_intersection(map)

#point
point <- read.csv("./Data/C14_Central.csv")
point <- data.frame(
point$X,
point$Y
)
point <- SpatialPointsDataFrame(point, data.frame(id=1:711))
point <- st_as_sf(point)

plot(grid)
plot(point, col="red" , add=TRUE)

enter image description here

在此处输入图像描述


I have executed the above code and generated the plot.
Now, I want to create a shapefile containing information about the number of points within the grid of that plot.

我已经执行了上面的代码并生成了情节。现在,我想创建一个shapefile文件,其中包含有关该绘图网格内的点数的信息。


I tried using st_join but it didn't work. What should I do?

我尝试使用st_Join,但不起作用。我该怎么办?


st_join

st_join


更多回答

can you share your csv file

您能否共享您的CSV文件

It's made up of three columns. X:Longtitude / Y:Latitude / Name: Name

它由三根柱子组成。X:经度/Y:纬度/名称:名称

Can you create a repoducible example using dput() or create a dataframe example of your csv. stackoverflow.com/questions/5963269/…

您能否使用dput()创建可复制的示例或创建CSV的数据帧示例。STACKOVERFLOW.com/Questions/5963269/…

优秀答案推荐
更多回答

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com