Skip to content

Commit

Permalink
attempt to preserve original class/type while also handling delete holes
Browse files Browse the repository at this point in the history
  • Loading branch information
timelyportfolio committed Jan 6, 2019
1 parent 0f8aeb7 commit 279831c
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions R/merge.R
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,18 @@ merge_edit <- function(
mapply(
function(ed, ed_id) {
matched_id_row = which(orig_ids == ed_id)
sf::st_geometry(orig2)[matched_id_row] <<- ed
# sf::st_geometry(orig2)[matched_id_row] <<- sf::st_geometry(sf::st_cast(
# sf::st_sfc(ed),
# as.character(sf::st_geometry_type(
# sf::st_geometry(orig2[matched_id_row,])
# ))
# ))
# sf::st_geometry(orig2)[matched_id_row] <<- ed
tryCatch(
sf::st_geometry(orig2)[matched_id_row] <<- sf::st_geometry(sf::st_cast(
sf::st_sfc(ed),
as.character(sf::st_geometry_type(
sf::st_geometry(orig2[matched_id_row,])
))
)),
error = function(e) {
sf::st_geometry(orig2)[matched_id_row] <<- ed
}
)
return(NULL)
},
sf::st_geometry(edits),
Expand Down

0 comments on commit 279831c

Please sign in to comment.