空间插值 sf对象
library(sf) library(gstat) library(openxlsx) library(magrittr) library(tidyverse) mycrs <- '+proj=lcc +lat_0=0 +lon_0=105 +lat_1=30 +lat_2=62 +x_0=0 +y_0=0 +ellps=krass +units=m +datum=WGS84 +no_defs' data_jiangshui <- read.xlsx('./Documents/wang_map/降水2005-2009修订后.xlsx') gs_station<- st_read("./Documents/wang_map/甘肃站点.shp") %>% st_transform(mycrs) gs_station %<>% inner_join(data_jiangshui,by=c('stationid'='stationid')) gs<- st_read("./Documents/wang_map/town_62.shp") %>% st_transform(mycrs) gs.border <- st_boundary(gs) gs.bou <- st_union(gs) %>% st_boundary() plot(gs.bou) grid <- st_make_grid(gs.bou, n = c(50, 50)) %>% st_transform(st_crs(gs_station)) plot(grid) st_crs(gs_station)$proj4string st_crs(grid)$proj4string vg.gs <- variogram(gs_station$`2005-7` ~ 1, gs_station) # vg.gs # plot(vg.gs$dist, vg.gs$gamma) # vgm.gs <- vgm(80, "Gau", 500,nugget=200) fit.gs &