Skip to content

Commit

Permalink
add st_rename
Browse files Browse the repository at this point in the history
  • Loading branch information
mikejohnson51 committed Nov 19, 2024
1 parent cf39c14 commit 1f848da
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 8 deletions.
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export(refactor_nhdplus)
export(sb_id)
export(split_catchment_divide)
export(split_flowlines)
export(st_rename)
export(union_linestrings)
export(union_linestrings_geos)
export(union_polygons)
Expand Down
13 changes: 13 additions & 0 deletions R/hydrofabric_io.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,20 @@ sb_id = function(type){
return(id)
}

#' Rename simple features layer
#' @inheritParams sf::st_write
#' @param new_layer new layer name
#' @return dsn
#' @export

st_rename = function(dsn, layer, new_layer) {
read_sf(dsn, layer) |>
write_sf(dsn, new_layer)

st_delete(dsn, layer)

dsn
}

#' Check if a geopackage and layer exists
#' This function checks if a layer exists in a geopackage
Expand Down
11 changes: 3 additions & 8 deletions man/gpkg.Rd → man/make_hf_gpkg_from_reference.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 26 additions & 0 deletions man/st_rename.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 1f848da

Please sign in to comment.