Skip to content

Commit

Permalink
cat -> message
Browse files Browse the repository at this point in the history
  • Loading branch information
SanderDevisscher committed Jan 7, 2025
1 parent 5bd63ac commit 07e5caf
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions R/shape_to_geojson.R
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ shape_to_geojson <- function(input,
filelist <- dir(path = input, pattern = ".shp", recursive = TRUE)
## Overwrite output with input if not specified
if(missing(output)){
cat("Output folder is not specified, using input folder as output folder")
message("Output folder is not specified, using input folder as output folder")
output <- input
}
}else{
Expand Down Expand Up @@ -107,21 +107,21 @@ shape_to_geojson <- function(input,
}

if(q_overwrite == FALSE & file.exists(here::here(output, output_fn))){
cat(paste0(f, " already exists >> skipping"))
message(paste0(f, " already exists >> skipping"))
next()
}

shape <- sf::st_read(here::here(input, paste0(f, ".shp")))

## Check if the shape has a crs ####
if(is.na(sf::st_crs(shape))){
cat(paste0(f, " has no crs, please provide a crs & retry >> skipping"))
message(paste0(f, " has no crs, please provide a crs & retry >> skipping"))
next()
}

## Check if the crs is not wgs84 ####
if(sf::st_crs(shape)$input != output_crs){
cat(paste0(f, " is not output crs >> transforming"))
message(paste0(f, " is not output crs >> transforming"))
shape <- sf::st_transform(shape, output_crs)
}

Expand Down

0 comments on commit 07e5caf

Please sign in to comment.