小编Isi*_*rus的帖子

将Lat/Lon点映射到R中的形状文件

我试图使用shapefile识别每组lat/lon坐标的邮政编码.

Lat Lon数据摘自:https://data.cityofchicago.org/Public-Safety/Crimes-2017/d62x-nvdr(Crimes _-_ 2001_to_present.csv)

Shapefile:https: //www2.census.gov/geo/tiger/PREVGENZ/zt/z500shp/zt17_d00.shp(伊利诺伊州的邮政编码定义)

library(rgeos)
library(maptools)

ccs<-read.csv("Crimes_-_2001_to_present.csv")
zip.map <- readOGR("zt17_d00.shp")
latlon<-ccs[,c(20,21)]
str(latlon)
   'data.frame':   6411517 obs. of  2 variables:
    $ Latitude : num  42 41.7 41.9 41.8 42 ...
    $ Longitude: num  -87.7 -87.6 -87.7 -87.6 -87.7 ...
coordinates(latlon) = ~Longitude+Latitude
write.csv(cbind(latlon,over(zip.map,latlon)),"zip.match.csv")
Run Code Online (Sandbox Code Playgroud)

这是我得到的错误:

(函数(classes,fdef,mtable)中的错误:无法为签名'"SpatialPolygonsDataFrame","data.frame"找到函数'over'的继承方法

我错过了什么?任何帮助表示赞赏!

geocoding r geospatial shapefile latitude-longitude

1
推荐指数
1
解决办法
2635
查看次数

标签 统计

geocoding ×1

geospatial ×1

latitude-longitude ×1

r ×1

shapefile ×1