Skip to content

Commit

Permalink
credentials storing fixed and documentation update
Browse files Browse the repository at this point in the history
  • Loading branch information
zozlak committed Jan 3, 2019
1 parent 701a58a commit 7c5e1d7
Show file tree
Hide file tree
Showing 16 changed files with 82 additions and 874 deletions.
2 changes: 1 addition & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ export(S2_query_product)
export(S2_query_qiData)
export(S2_query_roi)
export(S2_user_info)
export(roi_to_jgeom)
export(roi2jgeom)
20 changes: 13 additions & 7 deletions R/S2_initialize_user.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
cfgUser = '[email protected]'
cfgPswd = 'test'

#' Set login credentials for 's2.boku.eodc.eu'
#'
#' Set 'user' and 'password' login credentials for the current
Expand All @@ -15,13 +12,22 @@ cfgPswd = 'test'
#' 'https://s2.boku.eodc.eu'
#' @param password character password for 'https://s2.boku.eodc.eu'
#' @export
S2_initialize_user = function(user, password, permanent = TRUE) {
cfgUser <<- user
cfgPswd <<- password
S2_initialize_user = function(user, password) {
assign('cfgUser', user, parent.env(environment()))
assign('cfgPswd', password, parent.env(environment()))
}

#' Internal function getting user credentials
#'
get_credentials = function() {
return(c(user = cfgUser, password = cfgPswd))
try(
{
return(c(
user = get('cfgUser', parent.env(environment())),
password = get('cfgPswd', parent.env(environment()))
))
},
silent = TRUE
)
return(c(user = '[email protected]', password = 'test'))
}
8 changes: 4 additions & 4 deletions R/roi2jgeom.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#' will be reprojected as necessary
#' @return character, a json geometry string
#' @export
roi_to_jgeom = function(roi, projection = sp::CRS('+init=epsg:4326')){
roi2jgeom = function(roi, projection = sp::CRS('+init=epsg:4326')){
if (is.character(roi) && file.exists(roi)) {
roi = gsub(pattern = '[\\]', replacement = '/', roi)

Expand All @@ -24,12 +24,12 @@ roi_to_jgeom = function(roi, projection = sp::CRS('+init=epsg:4326')){
}
} else if (is.character(roi)) {
roi = rgdal::readOGR(roi, 'OGRGeoJSON', verbose = FALSE)
} else if (all(c("x", "y") %in% colnames(rbind(roi)))){
roi_geom = sp::SpatialPoints(xy, projection)
} else if (all(c("x", "y") %in% colnames(rbind(roi)))) {
roi_geom = sp::SpatialPoints(roi, projection)
}

roi = sp::spTransform(roi, CRSobj = sp::CRS('+init=epsg:4326'))
roi_geom = spat2jgeom(spat = roi, round = round)
roi_geom = spat2jgeom(spat = roi)

return(roi_geom)
}
74 changes: 0 additions & 74 deletions inst/doc/introduction.R

This file was deleted.

232 changes: 0 additions & 232 deletions inst/doc/introduction.Rmd

This file was deleted.

Loading

0 comments on commit 7c5e1d7

Please sign in to comment.