-1

I try to make Voronoy diagram in latitude/longitude cooredinates. Frist of all I made grid:

library(gstat)
library(sp)
longitude_for_data = c(32,68,89,145,176, -14, -42)   
latitude_for_data  = c(22, 8,21,13 , 16,- 34,-12)
Z_for_data         = c(10,20,30,40 , 50,  60, 70)
data_together      = cbind(longitude_for_data,latitude_for_data,Z_for_data)
data_to_analise    = as.data.frame(data_together)
coordinates(data_to_analise) <- ~longitude_for_data + latitude_for_data
proj4string(data_to_analise) <- CRS("+init=epsg:4326")

longitude    = seq(-180,180,by=5.0)
latitude     = seq(-90 ,90 ,by=2.5)
lat_long_together= expand.grid(longitude,latitude)
lat_long_grid    =as.data.frame(lat_long_together)
colnames(lat_long_grid)[1:2] <- c("longitude", "latitude")
coordinates(lat_long_grid) <- ~longitude + latitude
proj4string(lat_long_grid) <- CRS("+init=epsg:4326")
m <- vgm(.59, "Sph", 874, .04)

result= krige(Z_for_data~1, data_to_analise, lat_long_grid, model = m)

then I tried to make Voronoy diagram with that grid:

deldir(result)

After failing I tried another variant:

result_2=as.data.frame(result)
z= dildir(result_2$longitude,result_2$latitude)

But the square of area(del.area) in the z data are equal. As a results I want to get such file:

longitude latitude area_of_Voronoy_polygon result$z (var1.pred from result column)

How should I solve this problem?

  • result is a regular grid of points. do plot(result) and you should see this. The voronoi tesselation of a regular grid is going to be a grid of rectangular polygons, one for each source point. Is that what you want? – Spacedman Mar 22 at 16:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.