How to calculate IDW (inverse distance weight) for multipolygon geometry in R (spdep lib)

58 views Asked by At

I have a sfc dataframe and would like to change the weights for my distances from equal weights to IDW. I tried many conversions from multipolygon sfc to other types (like polygon, point, etc.), but it does not seem to work out. I am using R library spded. My code is as follows:

mg.rook <- poly2nb(df_mun_sp$geom, queen = FALSE)

rook.listw <- nb2listw(mg.rook,style="W",zero.policy = TRUE)

where df_mun_sp$geom is a column with geometries for each place, printing we have:


Geometry set for 588 features

Geometry type: MULTIPOLYGON Dimension: XY

Bounding box: xmin: -53.10986 ymin: -25.35794 xmax: -44.16137 ymax: -19.77966

Geodetic CRS: SIRGAS 2000


Is there a way to get the coordinates for these 588 features? When I cast for other types I get many more features than 588, returning size error when calculating the IDW with nbdists for example.

0

There are 0 answers