Created
September 5, 2019 17:13
-
-
Save mattbk/4cda0eaddd0c8c8b154e51244896812c to your computer and use it in GitHub Desktop.
Convert sf point set geometry from XY to XYZ using an existing column
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_z <- function(x, z_name){ | |
st_geometry(x) <- st_sfc(st_multipoint(cbind(st_coordinates(x), | |
x[[z_name]]))) %>% | |
st_cast("POINT") | |
return(x) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment