Description Usage Arguments Value Examples
Converts a dataframe with a column of characters containing the WKT encoded geometries into an sf object. The column is converted to sfc.
1 | getgeometry(inventory, var)
|
inventory |
(data.frame) with a column of characters, which contains the WKT encoded geometries. |
var |
Name of the character column that holds WKT encoded geometries, as a data/env-variable. |
An sf object
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | data(Paracou6_2016)
felttrees <- Paracou6_2016 %>%
dplyr::filter(VernName == "wacapou") %>%
dplyr::group_by(idTree) %>%
dplyr::do(LocPts = # inform geometry.
sf::st_point(c(.$Xutm,.$Yutm)) %>%
sf::st_as_text()) %>% # as text to easy join with a non spacial table
tidyr::unnest(LocPts) # here to pass from list to character
inventory <- dplyr::left_join(Paracou6_2016, felttrees, by = "idTree")
Rslt <- getgeometry (inventory, LocPts)
library(ggplot2)
ggplot() +
geom_sf(data = Rslt)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.