From b9c4114eec7e9b50a3f0f96acae8de34e0619864 Mon Sep 17 00:00:00 2001 From: tim-salabim Date: Fri, 10 Jul 2020 15:36:42 +0200 Subject: [PATCH] no spaces in layerid; stop if fgb file doesn't exists. closes https://github.com/r-spatial/mapview/issues/308 and addresses #24 --- R/file.R | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/R/file.R b/R/file.R index 3609c04..413b1c6 100644 --- a/R/file.R +++ b/R/file.R @@ -345,8 +345,18 @@ addFgb = function(map, if (is.null(layerId)) layerId = group layerId = gsub("\\.", "_", layerId) + layerId = gsub(" ", "", layerId) if (!is.null(file)) { + if (!file.exists(file)) { + stop( + sprintf( + "file %s does not seem to exist" + , file + ) + , call. = FALSE + ) + } path_layer = tempfile() dir.create(path_layer) path_layer = paste0(path_layer, "/", layerId, "_layer.fgb")