Skip to content

Commit

Permalink
read_GRTSmh*(): use full proj4string; fixes #67
Browse files Browse the repository at this point in the history
  • Loading branch information
florisvdh committed May 8, 2020
1 parent f65ea57 commit 9d891ee
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ importFrom(rprojroot,is_rstudio_project)
importFrom(sf,"st_crs<-")
importFrom(sf,read_sf)
importFrom(sf,st_centroid)
importFrom(sf,st_crs)
importFrom(sf,st_drop_geometry)
importFrom(sf,st_transform)
importFrom(stats,setNames)
Expand Down
11 changes: 8 additions & 3 deletions R/GRTSmh.R
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,8 @@ convert_base4frac_to_dec <-
#' }
#'
#' @export
#' @importFrom sf
#' st_crs
#' @importFrom raster
#' raster
#' brick
Expand All @@ -335,7 +337,7 @@ read_GRTSmh <-
}
result <- r
}
crs(result) <- "+init=epsg:31370"
crs(result) <- st_crs(31370)$proj4string
return(result)
}

Expand Down Expand Up @@ -425,14 +427,16 @@ read_GRTSmh <-
#' }
#'
#' @export
#' @importFrom sf
#' st_crs
#' @importFrom raster
#' raster
#' crs<-
read_GRTSmh_base4frac <-
function(path = fileman_up("n2khab_data"),
file = "20_processed/GRTSmh_base4frac/GRTSmh_base4frac.tif") {
r <- raster(file.path(path, file))
crs(r) <- "+init=epsg:31370"
crs(r) <- st_crs(31370)$proj4string
return(r)
}

Expand Down Expand Up @@ -575,6 +579,7 @@ read_GRTSmh_base4frac <-
#' @importFrom stringr str_c
#' @importFrom sf
#' read_sf
#' st_crs
#' st_crs<-
#' @importFrom raster
#' raster
Expand Down Expand Up @@ -607,7 +612,7 @@ read_GRTSmh_diffres <-
str_c("GRTSmh_diffres.",
level, ".tif")))
names(r) <- str_c("level", level)
crs(r) <- "+init=epsg:31370"
crs(r) <- st_crs(31370)$proj4string
r

}
Expand Down

0 comments on commit 9d891ee

Please sign in to comment.