We will use st_voronoi() to create a Voronoi diagram.
I have three questions.
I understand that the argument to st_voronoi() should be the following data.
■SFC format (an error occurs in SF format)
■MULTIPOINT format(Not in POINT form.) Is this understanding correct?
If you run the following code, it will be converted to GEOMETRYCOLLECTION. Is there a way to convert this to MULTIPOINT?
The original "nz_height" contains the word "elevation". However, the conversion to SFC format has erased that column. I would like to figure out the elevation of each area of the Voronoi diagram. What kind of processing should I do?
If there is anyone who knows about it, please tell us about it.
library(sf) library(sp) library(spData) print(class(nz)) print(class(nz_height)) print(head(nz_height)) plot(st_geometry(nz_height)) #POINT to MULTIPOINT nz_height_mp <- st_cast(nz_height,"MULTIPOINT") print(head(nz_height_mp)) #sf to sfc nz_height_mp_sfc <- st_union(nz_height_mp) print(class(nz_height_mp_sfc)) print(head(nz_height_mp_sfc)) nz_height_v <-st_voronoi(nz_height_mp_sfc) print(class(nz_height_v)) print(head(nz_height_v)) plot(st_geometry(nz_height_v),col=0)