Procházet zdrojové kódy

Muudetud funktsioonide kirjeldusi. Lisatud kirjelduste abifailid.

Ardo Kubjas před 5 roky
rodič
revize
6c707a3aee

+ 358 - 297
.Rhistory

@@ -1,300 +1,3 @@
-config <- ruut::get_config()
-config
-config$dbname
-names(config)
-names(config) %in% c("dbname","host","port","user","password")
-names(config)
-c("dbname","host","port","user","password") %in% names(config)
-all(c("dbname","host","port","user","password") %in% names(config))
-styler:::style_active_file()
-RPostgreSQL::PostgreSQL()
-config <- ruut::get_config()
-try(conn <- DBI::dbConnect(RPostgreSQL::PostgreSQL(),
-dbname = config$dbname, host = config$host,
-user = config$user, password = config$password,
-port = config$port
-))
-(
-conn
-)
-db_connect <- function(conf = NULL) {
-if (is.null(conf)) {
-config <- ruut::get_config()
-} else {
-config <- conf
-}
-if (all(c("dbname", "host", "port", "user", "password") %in% names(config))) {
-try(conn <- DBI::dbConnect(RPostgreSQL::PostgreSQL(),
-dbname = config$dbname, host = config$host,
-user = config$user, password = config$password,
-port = config$port
-))
-} else {
-print("Andmebaasiga \U00FChendamise parameetrid puudulikud. Palun kontrolli konfiguratsiooni faili.")
-return()
-}
-## Andmebaasiga ühenduse kontroll
-if (exists("conn") && !inherits(conn, "try-error")) {
-print("Connection exist")
-} else {
-print("Connection error")
-}
-}
-conn <- DBI::dbConnect(RPostgreSQL::PostgreSQL(),
-dbname = config$dbname, host = config$host,
-user = config$user, password = config$password,
-port = config$port
-)
-conn <- DBI::dbConnect(RPostgreSQL::PostgreSQL(),
-dbname = config$dbname, host = config$host,
-user = config$user, password = config$password,
-port = config$port
-)
-conn <- DBI::dbConnect(RPostgreSQL::PostgreSQL(),
-dbname = config$dbname, host = config$host,
-user = config$user, password = config$password,
-port = config$port
-)
-config <- ruut::get_config()
-config
-conn <- DBI::dbConnect(RPostgreSQL::PostgreSQL(),
-dbname = config$dbname, host = config$host,
-user = config$user, password = config$password,
-port = config$port
-)
-conn
-## Andmebaasiga ühenduse kontroll
-if (exists("conn") && !inherits(conn, "try-error")) {
-print("Connection exist")
-} else {
-print("Connection error")
-}
-styler:::style_active_file()
-library(ruut)
-ruut::dbconnect()
-library(ruut)
-ruut::pk_bbox()
-ruut::cat_function()
-ruut::get_config()
-source("R/db_connect.R")
-conn <- db_connect()
-conn
-source("./R/db_connect.R")
-source("./R/db_connect.R")
-conn <- db_connect()
-conn
-source("db_connect.R")
-styler:::style_active_file()
-ruut::cat_function()
-print(file.exists(system.file(c("db_connect.R"), package = "ruut")))
-print(file.exists(system.file(c("db_connect.R"), package = "ruut")))
-ruut::cat_function()
-library(ruut)
-ruut::cat_function()
-library(ruut)
-ruut::cat_function()
-print(file.exists(system.file(c("db_connect.R"), package = "ruut")))
-print(file.exists(system.file(c("R","db_connect.R"), package = "ruut")))
-library(ruut)
-ruut::cat_function()
-ruut::cat_function()
-styler:::style_active_file()
-library(ruut)
-ruut::cat_function()
-paste0(getwd(),"/R/db_connect.R")
-file.exists(paste0(getwd(),"/R/db_connect.R"))
-library(ruut)
-ruut::cat_function()
-ruut::cat_function()
-library(ruut)
-ruut::cat_function()
-styler:::style_active_file()
-library(ruut)
-ruut::cat_function()
-db_connect <- function(conf = NULL) {
-if (is.null(conf)) {
-config <- ruut::get_config()
-} else {
-config <- conf
-}
-if (all(c("dbname", "host", "port", "user", "password") %in% names(config))) {
-try(conn <- DBI::dbConnect(RPostgreSQL::PostgreSQL(),
-dbname = config$dbname, host = config$host,
-user = config$user, password = config$password,
-port = config$port
-))
-} else {
-conn <- NULL
-print("Andmebaasiga \U00FChendamise parameetrid puudulikud. Palun kontrolli konfiguratsiooni faili.")
-return()
-}
-## Andmebaasiga ühenduse kontroll
-if (exists("conn") && !inherits(conn, "try-error")) {
-print("Connection exist")
-} else {
-print("Connection error")
-}
-}
-db_connect()
-db_connect(conf = conf)
-config <- ruut::get_config()
-db_connect(conf = config)
-db_connect(conf = c("3"))
-conn
-dbDisconnect(conn)
-dbDisconnect(conn)
-conn
-library(ruut)
-db_connect()
-xxx <- db_connect()
-xxx
-library(ruut)
-xxx <- db_connect()
-db_connect()
-library(ruut)
-source(paste0(getwd(),"/R/db_connect.R"))
-conn <- db_connect()
-conn
-library(ruut)
-source(paste0(getwd(),"/R/db_connect.R"))
-conn <- db_connect()
-styler:::style_active_file()
-get_config <- function(conf = NULL) {
-if (is.null(conf)) {
-config <- rjson::fromJSON(file = system.file("extdata", "config.json", package = "ruut"))
-}
-else {
-config <- conf
-}
-return(config)
-}
-get_config
-get_config()
-styler:::style_active_file()
-styler:::style_active_file()
-styler:::style_active_file()
-library(ruut)
-library(ruut)
-qgis_algorithm_search_by_word(str = "bound")
-algorithm <- "native:boundingboxes"
-## Read help!!!
-cat(qgis_show_help(algorithm = algorithm))
-# Run algorithm.
-library(ruut)
-library(ruut)
-source(paste0(getwd(),"/R/db_connect.R"))
-conn <- db_connect()
-all_schemas <- DBI::dbGetQuery(conn, "SELECT SCHEMA_NAME FROM INFORMATION_SCHEMA.SCHEMATA")
-all_schemas
-db_all_schemas <- function() {
-source(paste0(getwd(),"/R/db_connect.R"))
-conn <- db_connect()
-all_schemas <- DBI::dbGetQuery(conn, "SELECT SCHEMA_NAME FROM INFORMATION_SCHEMA.SCHEMATA")
-all_schemas$schema_name
-}
-db_all_schemas()
-db_is_shema_exist <- function(schema = NULL) {
-if(schema %in% db_all_schemas()) return(TRUE) else return(FALSE)
-}
-db_is_shema_exist("xxxx")
-aaa <- db_is_shema_exist("xxxx")
-aaa <- db_is_shema_exist("x_matsalu")
-aaa <- db_is_shema_exist("x_matsalu")
-schema = "x_matsalu"
-schema %in% db_all_schemas()
-db_all_schemas()
-aaa <- db_is_shema_exist(schema = "x_matsalu")
-aaa
-aaa <- db_is_shema_exist(schema = "sx_matsalu")
-aaa <- db_is_shema_exist(schema = "sx_matsalu")
-aaa <- db_is_shema_exist(schema = "sx_matsalu")
-db_is_shema_exist <- function(schema = NULL) {
-if(schema %in% db_all_schemas())
-return(TRUE)
-else
-return(FALSE)
-}
-aaa <- db_is_shema_exist(schema = "sx_matsalu")
-aaa <- db_is_shema_exist(schema = "sx_matsalu")
-aaa
-aaa <- db_is_shema_exist(schema = "x_matsalu")
-aaa <- db_is_shema_exist(schema = "x_matsalu")
-DBI::dbDisconnect(conn)
-DBI::dbDisconnect(conn)
-DBI::dbDisconnect(conn)
-aaa <- db_is_shema_exist(schema = "x_matsalu")
-aaa <- db_is_shema_exist(schema = "x_matsalu")
-aaa <- db_is_shema_exist(schema = "x_matsalu")
-aaa <- db_is_shema_exist(schema = "x_matsalu")
-db_is_shema_exist(schema = "x_matsalu")
-DBI::dbDisconnect(conn)
-DBI::dbDisconnect(conn)
-DBI::dbDisconnect(conn)
-DBI::dbDisconnect(conn)
-DBI::dbDisconnect(conn)
-DBI::dbDisconnect(conn)
-db_is_shema_exist(schema = "x_matsalu")
-conn <- db_connect()
-all_schemas <- DBI::dbGetQuery(conn, "SELECT SCHEMA_NAME FROM INFORMATION_SCHEMA.SCHEMATA")
-all_schemas$schema_name
-db_all_schemas <- function() {
-source(paste0(getwd(),"/R/db_connect.R"))
-conn <- db_connect()
-all_schemas <- DBI::dbGetQuery(conn, "SELECT SCHEMA_NAME FROM INFORMATION_SCHEMA.SCHEMATA")
-return (all_schemas$schema_name)
-}
-db_all_schemas()
-db_all_schemas()
-db_all_schemas()
-db_all_schemas()
-source(paste0(getwd(),"/R/db_connect.R"))
-conn <- db_connect()
-source(paste0(getwd(),"/R/db_connect.R"))
-conn <- db_connect()
-source(paste0(getwd(),"/R/db_connect.R"))
-conn <- db_connect()
-db_all_schemas <- function() {
-source(paste0(getwd(),"/R/db_connect.R"))
-conn <- db_connect()
-all_schemas <- DBI::dbGetQuery(conn, "SELECT SCHEMA_NAME FROM INFORMATION_SCHEMA.SCHEMATA")
-return (all_schemas$schema_name)
-}
-# db_all_schemas()
-db_is_shema_exist <- function(schema = NULL) {
-if(schema %in% db_all_schemas())
-return(TRUE)
-else
-return(FALSE)
-}
-DBI::dbDisconnect(conn)
-conn <- db_connect()
-conn <- db_connect()
-conn <- db_connect()
-library(ruut)
-conn <- db_connect()
-source(paste0(getwd(),"/R/db_connect.R"))
-conn <- db_connect()
-all_schemas <- DBI::dbGetQuery(conn, "SELECT SCHEMA_NAME FROM INFORMATION_SCHEMA.SCHEMATA")
-all_schemas
-all_schemas$schema_name
-library(ruut)
-db_all_schemas <- function() {
-source(paste0(getwd(),"/R/db_connect.R"))
-conn <- db_connect()
-all_schemas <- DBI::dbGetQuery(conn, "SELECT SCHEMA_NAME FROM INFORMATION_SCHEMA.SCHEMATA")
-return (all_schemas$schema_name)
-}
-# db_all_schemas()
-db_is_shema_exist <- function(schema = NULL) {
-if(schema %in% db_all_schemas())
-return(TRUE)
-else
-return(FALSE)
-}
-db_all_schemas()
-db_is_shema_exist <- function(schema = NULL) {
-if(schema %in% db_all_schemas())
-return(TRUE)
 else
 return(FALSE)
 }
@@ -449,3 +152,361 @@ library(ruut)
 styler:::style_active_file()
 library(ruut)
 library(ruut)
+library(ruut)
+library(ruut)
+library(ruut)
+ogr2ogr --long-usage
+system("ogr2ogr --long-usage")
+library(ruut)
+library(ruut)
+library(ruut)
+styler:::style_active_file()
+styler:::style_active_file()
+system("ogr2ogr --long-usage")
+styler:::style_active_file()
+styler:::style_active_file()
+library(ruut)
+#'
+#' INSPIRE grid map
+#'
+library(dplyr)
+library(ruut)
+# Source: https://www.eea.europa.eu/data-and-maps/data/eea-reference-grids-2
+# Temp directory
+tmp_dir <- tempdir()
+# Download link
+url <- "https://www.eea.europa.eu/data-and-maps/data/eea-reference-grids-2/gis-files/estonia-shapefile/download"
+# Estonia shapefile (ZIP archive)
+map_shapefile <- "Estonia_shapefile.zip"
+# Download and sav
+saveTo <- sprintf("%s/%s", tmp_dir, map_shapefile)
+download.file(
+url = download_url,
+destfile = saveTo, method = "curl", extra = "-L"
+)
+# Unzip
+unzip(saveTo, overwrite = T, exdir = tmp_dir)
+# List of files
+ls <- list.files(path = tmp_dir, pattern = ".shp")
+ls_long <- list.files(path = tmp_dir, pattern = ".shp", full.names = T)
+tbl_names <- strsplit(x = ls, split = ".shp") %>% unlist()
+# Export to postgis
+schema <- "inspire"
+i <- 1
+config <- get_config()
+config$schema <- schema
+# New schema
+db_create_new_schema(conf = config)
+library(dplyr)
+library(ruut)
+# Source: https://www.eea.europa.eu/data-and-maps/data/eea-reference-grids-2
+# Temp directory
+tmp_dir <- tempdir()
+# Download link
+url <- "https://www.eea.europa.eu/data-and-maps/data/eea-reference-grids-2/gis-files/estonia-shapefile/download"
+# Estonia shapefile (ZIP archive)
+map_shapefile <- "Estonia_shapefile.zip"
+# Download and sav
+saveTo <- sprintf("%s/%s", tmp_dir, map_shapefile)
+download.file(
+url = url,
+destfile = saveTo, method = "curl", extra = "-L"
+)
+# Unzip
+unzip(saveTo, overwrite = T, exdir = tmp_dir)
+# List of files
+ls <- list.files(path = tmp_dir, pattern = ".shp")
+ls_long <- list.files(path = tmp_dir, pattern = ".shp", full.names = T)
+tbl_names <- strsplit(x = ls, split = ".shp") %>% unlist()
+# Export to postgis
+schema <- "inspire"
+i <- 1
+config <- get_config()
+config$schema <- schema
+# New schema
+db_create_new_schema(conf = config)
+print(tbl_names[i])
+config$table <- tbl_names[i]
+source <- sprintf('"%s" "%s"', tmp_dir, tbl_names[i])
+crs_source <- "-s_srs EPSG:3035"
+crs_target <- "-t_srs EPSG:4326"
+fid <- "fid"
+ruut::copy_shp_to_db(dir = tmp_dir, layer = tbl_names[i], conf = config,
+id = fid, crs_source = crs_source, crs_target = crs_target,
+geometry_type = 'POLYGON')
+dir = tmp_dir; layer = tbl_names[i]; conf = config;
+id = fid; crs_source = crs_source; crs_target = crs_target;
+geometry_type = 'POLYGON'
+length(list.files(path = dir, pattern = sprintf("%s*", layer)))
+length(list.files(path = dir, pattern = sprintf("%s*", layer))) > 0
+source <- sprintf('"%s" "%s"', dir, layer)
+source
+cmd <- sprintf(
+paste0(
+"ogr2ogr -progress --conf PG_USE_COPY YES -f PostgreSQL ",
+"PG:\" dbname='%s' host=%s port=%d user='%s' password='%s' ",
+"sslmode=%s active_schema=%s \" -lco DIM=2 %s -overwrite -nlt GEOMETRY ",
+"-lco GEOMETRY_NAME=geometry -lco FID=%s -nln %s.%s ",
+"%s %s -nlt %s"
+),
+conf$dbname, conf$host, conf$port, conf$user, conf$password,
+conf$sslmode, conf$schema, source, id, conf$schema, conf$table,
+crs_source, crs_target, geometry_type
+)
+cmd
+system(cmd)
+dir = tmp_dir; layer = tbl_names[i]; conf = config;
+id = fid; crs_source = crs_source; crs_target = crs_target;
+geometry_type = 'PROMOTE_TO_MULTI'
+cmd <- sprintf(
+paste0(
+"ogr2ogr -progress --conf PG_USE_COPY YES -f PostgreSQL ",
+"PG:\" dbname='%s' host=%s port=%d user='%s' password='%s' ",
+"sslmode=%s active_schema=%s \" -lco DIM=2 %s -overwrite -nlt GEOMETRY ",
+"-lco GEOMETRY_NAME=geometry -lco FID=%s -nln %s.%s ",
+"%s %s -nlt %s"
+),
+conf$dbname, conf$host, conf$port, conf$user, conf$password,
+conf$sslmode, conf$schema, source, id, conf$schema, conf$table,
+crs_source, crs_target, geometry_type
+)
+cmd
+ruut::db_create_new_schema(conf)
+system(cmd)
+cmd <- sprintf(
+paste0(
+"ogr2ogr -progress --config PG_USE_COPY YES -f PostgreSQL ",
+"PG:\" dbname='%s' host=%s port=%d user='%s' password='%s' ",
+"sslmode=%s active_schema=%s \" -lco DIM=2 %s -overwrite -nlt GEOMETRY ",
+"-lco GEOMETRY_NAME=geometry -lco FID=%s -nln %s.%s ",
+"%s %s -nlt PROMOTE_TO_MULTI"
+),
+config$dbname, config$host, config$port, config$user, config$password,
+config$sslmode, config$schema, source, fid, config$schema, config$table,
+crs_source, crs_target
+)
+cmd
+system(cmd)
+geometry_type = 'POLYGON'
+cmd <- sprintf(
+paste0(
+"ogr2ogr -progress --config PG_USE_COPY YES -f PostgreSQL ",
+"PG:\" dbname='%s' host=%s port=%d user='%s' password='%s' ",
+"sslmode=%s active_schema=%s \" -lco DIM=2 %s -overwrite -nlt GEOMETRY ",
+"-lco GEOMETRY_NAME=geometry -lco FID=%s -nln %s.%s ",
+"%s %s -nlt %s"
+),
+config$dbname, config$host, config$port, config$user, config$password,
+config$sslmode, config$schema, source, fid, config$schema, config$table,
+crs_source, crs_target, geometry_type
+)
+cmd
+system(cmd)
+system("ogr2ogr --long-usage")
+cmd <- sprintf(
+paste0(
+"ogr2ogr -progress --config PG_USE_COPY YES -f PostgreSQL ",
+"PG:\" dbname='%s' host=%s port=%d user='%s' password='%s' ",
+"sslmode=%s active_schema=%s \" -lco DIM=2 %s -overwrite -nlt GEOMETRY ",
+"-lco GEOMETRY_NAME=geometry -lco FID=%s -nln %s.%s ",
+"-s_srs%s -t_srs -nlt %s"
+),
+config$dbname, config$host, config$port, config$user, config$password,
+config$sslmode, config$schema, source, fid, config$schema, config$table,
+crs_source, crs_target, geometry_type
+)
+system(cmd)
+cmd <- sprintf(
+paste0(
+"ogr2ogr -progress --config PG_USE_COPY YES -f PostgreSQL ",
+"PG:\" dbname='%s' host=%s port=%d user='%s' password='%s' ",
+"sslmode=%s active_schema=%s \" -lco DIM=2 %s -overwrite -nlt GEOMETRY ",
+"-lco GEOMETRY_NAME=geometry -lco FID=%s -nln %s.%s ",
+"%s %s -nlt %s"
+),
+config$dbname, config$host, config$port, config$user, config$password,
+config$sslmode, config$schema, source, fid, config$schema, config$table,
+crs_source, crs_target, geometry_type
+)
+system(cmd)
+crs_target
+crs_source
+cmd
+cmd <- sprintf(
+paste0(
+"ogr2ogr -progress --conf PG_USE_COPY YES -f PostgreSQL ",
+"PG:\" dbname='%s' host=%s port=%d user='%s' password='%s' ",
+"sslmode=%s active_schema=%s \" -lco DIM=2 %s -overwrite -nlt GEOMETRY ",
+"-lco GEOMETRY_NAME=geometry -lco FID=%s -nln %s.%s ",
+"%s %s -nlt %s"
+),
+conf$dbname, conf$host, conf$port, conf$user, conf$password,
+conf$sslmode, conf$schema, source, id, conf$schema, conf$table,
+crs_source, crs_target, geometry_type
+)
+cmd
+crs_target
+crs_source = "EPSG:4326"
+cmd <- sprintf(
+paste0(
+"ogr2ogr -progress --conf PG_USE_COPY YES -f PostgreSQL ",
+"PG:\" dbname='%s' host=%s port=%d user='%s' password='%s' ",
+"sslmode=%s active_schema=%s \" -lco DIM=2 %s -overwrite -nlt GEOMETRY ",
+"-lco GEOMETRY_NAME=geometry -lco FID=%s -nln %s.%s ",
+"%s %s -nlt %s"
+),
+conf$dbname, conf$host, conf$port, conf$user, conf$password,
+conf$sslmode, conf$schema, source, id, conf$schema, conf$table,
+crs_source, crs_target, geometry_type
+)
+source('~/apps/R/packages/ruut/R/copy_shp_to_db.R', echo=TRUE)
+cmd
+cmd <- sprintf(
+paste0(
+"ogr2ogr -progress --conf PG_USE_COPY YES -f PostgreSQL ",
+"PG:\" dbname='%s' host=%s port=%d user='%s' password='%s' ",
+"sslmode=%s active_schema=%s \" -lco DIM=2 %s -overwrite -nlt GEOMETRY ",
+"-lco GEOMETRY_NAME=geometry -lco FID=%s -nln %s.%s ",
+"-s_srs %s -t_srs %s -nlt %s"
+),
+conf$dbname, conf$host, conf$port, conf$user, conf$password,
+conf$sslmode, conf$schema, source, id, conf$schema, conf$table,
+crs_source, crs_target, geometry_type
+)
+copy_shp_to_db <- function(dir = NULL, layer = NULL, conf = NULL, id = "fid",
+crs_source = "EPSG:4326",
+crs_target = "EPSG:4326",
+geometry_type = "PROMOTE_TO_MULTI") {
+# Command 'ogr2ogr' help
+# system("ogr2ogr --long-usage")
+# Kontrollime kas etteantud kataloogis paiknevad failid
+if (length(list.files(path = dir, pattern = sprintf("%s*", layer))) > 0) {
+source <- sprintf('"%s" "%s"', dir, layer)
+cmd <- sprintf(
+paste0(
+"ogr2ogr -progress --conf PG_USE_COPY YES -f PostgreSQL ",
+"PG:\" dbname='%s' host=%s port=%d user='%s' password='%s' ",
+"sslmode=%s active_schema=%s \" -lco DIM=2 %s -overwrite -nlt GEOMETRY ",
+"-lco GEOMETRY_NAME=geometry -lco FID=%s -nln %s.%s ",
+"-s_srs %s -t_srs %s -nlt %s"
+),
+conf$dbname, conf$host, conf$port, conf$user, conf$password,
+conf$sslmode, conf$schema, source, id, conf$schema, conf$table,
+crs_source, crs_target, geometry_type
+)
+ruut::db_create_new_schema(conf)
+Sys.sleep(1)
+system(cmd)
+} else {
+cat("\nEi leitud antud kataloogist faile.")
+return(NULL)
+}
+}
+ruut::copy_shp_to_db(dir = tmp_dir, layer = tbl_names[i], conf = config,
+id = fid, crs_source = crs_source, crs_target = crs_target,
+geometry_type = 'POLYGON')
+cmd <- sprintf(
+paste0(
+"ogr2ogr -progress --config PG_USE_COPY YES -f PostgreSQL ",
+"PG:\" dbname='%s' host=%s port=%d user='%s' password='%s' ",
+"sslmode=%s active_schema=%s \" -lco DIM=2 %s -overwrite -nlt GEOMETRY ",
+"-lco GEOMETRY_NAME=geometry -lco FID=%s -nln %s.%s ",
+"-s_srs %s -t_srs %s -nlt %s"
+),
+conf$dbname, conf$host, conf$port, conf$user, conf$password, conf$sslmode,
+conf$schema, x, id, conf$schema, conf$table, crs_source, crs_target,
+geometry_type
+)
+source <- sprintf('"%s" "%s"', dir, layer)
+cmd <- sprintf(
+paste0(
+"ogr2ogr -progress --conf PG_USE_COPY YES -f PostgreSQL ",
+"PG:\" dbname='%s' host=%s port=%d user='%s' password='%s' ",
+"sslmode=%s active_schema=%s \" -lco DIM=2 %s -overwrite -nlt GEOMETRY ",
+"-lco GEOMETRY_NAME=geometry -lco FID=%s -nln %s.%s ",
+"-s_srs %s -t_srs %s -nlt %s"
+),
+conf$dbname, conf$host, conf$port, conf$user, conf$password,
+conf$sslmode, conf$schema, source, id, conf$schema, conf$table,
+crs_source, crs_target, geometry_type
+)
+cmd
+system(cmd)
+cmd <- sprintf(
+paste0(
+"ogr2ogr -progress --config PG_USE_COPY YES -f PostgreSQL ",
+"PG:\" dbname='%s' host=%s port=%d user='%s' password='%s' ",
+"sslmode=%s active_schema=%s \" -lco DIM=2 %s -overwrite -nlt GEOMETRY ",
+"-lco GEOMETRY_NAME=geometry -lco FID=%s -nln %s.%s ",
+"%s %s -nlt %s"
+),
+config$dbname, config$host, config$port, config$user, config$password,
+config$sslmode, config$schema, source, fid, config$schema, config$table,
+crs_source, crs_target, geometry_type
+)
+system(cmd)
+source <- sprintf('"%s" "%s"', tmp_dir, tbl_names[i])
+crs_source <- "EPSG:3035"
+crs_target <- "EPSG:4326"
+fid <- "fid"
+cmd <- sprintf(
+paste0(
+"ogr2ogr -progress --config PG_USE_COPY YES -f PostgreSQL ",
+"PG:\" dbname='%s' host=%s port=%d user='%s' password='%s' ",
+"sslmode=%s active_schema=%s \" -lco DIM=2 %s -overwrite -nlt GEOMETRY ",
+"-lco GEOMETRY_NAME=geometry -lco FID=%s -nln %s.%s ",
+"-s_srs %s -t_srs %s -nlt %s"
+),
+config$dbname, config$host, config$port, config$user, config$password,
+config$sslmode, config$schema, source, fid, config$schema, config$table,
+crs_source, crs_target, geometry_type
+)
+system(cmd)
+config
+conf
+config
+cmd <- sprintf(
+paste0(
+"ogr2ogr -progress --config PG_USE_COPY YES -f PostgreSQL ",
+"PG:\" dbname='%s' host=%s port=%d user='%s' password='%s' ",
+"sslmode=%s active_schema=%s \" -lco DIM=2 %s -overwrite -nlt GEOMETRY ",
+"-lco GEOMETRY_NAME=geometry -lco FID=%s -nln %s.%s ",
+"-s_srs %s -t_srs %s -nlt %s"
+),
+config$dbname, config$host, config$port, config$user, config$password,
+config$sslmode, config$schema, source, fid, config$schema, config$table,
+crs_source, crs_target, geometry_type
+)
+system(cmd)
+cmd <- sprintf(
+paste0(
+"ogr2ogr -progress --conf PG_USE_COPY YES -f PostgreSQL ",
+"PG:\" dbname='%s' host=%s port=%d user='%s' password='%s' ",
+"sslmode=%s active_schema=%s \" -lco DIM=2 %s -overwrite -nlt GEOMETRY ",
+"-lco GEOMETRY_NAME=geometry -lco FID=%s -nln %s.%s ",
+"-s_srs %s -t_srs %s -nlt %s"
+),
+conf$dbname, conf$host, conf$port, conf$user, conf$password,
+conf$sslmode, conf$schema, source, id, conf$schema, conf$table,
+crs_source, crs_target, geometry_type
+)
+system(cmd)
+cmd <- sprintf(
+paste0(
+"ogr2ogr -progress --config PG_USE_COPY YES -f PostgreSQL ",
+"PG:\" dbname='%s' host=%s port=%d user='%s' password='%s' ",
+"sslmode=%s active_schema=%s \" -lco DIM=2 %s -overwrite -nlt GEOMETRY ",
+"-lco GEOMETRY_NAME=geometry -lco FID=%s -nln %s.%s ",
+"-s_srs %s -t_srs %s -nlt %s"
+),
+conf$dbname, conf$host, conf$port, conf$user, conf$password,
+conf$sslmode, conf$schema, source, fid, conf$schema, conf$table,
+crs_source, crs_target, geometry_type
+)
+system(cmd)
+styler:::style_active_file()
+library(ruut)
+styler:::style_active_file()
+styler:::style_active_file()
+library(ruut)
+styler:::style_active_file()

+ 1 - 0
NAMESPACE

@@ -1,6 +1,7 @@
 # Generated by roxygen2: do not edit by hand
 
 export(cat_function)
+export(construct_ogr2ogr_PG_connect_str)
 export(convert_sf2qgis)
 export(copy_qgis_object_to_db)
 export(copy_shp_to_db)

+ 1 - 1
R/construct_ogr2ogr_PG_connect_str.R

@@ -1,7 +1,7 @@
 #' 'ogr2ogr' käsus oleva PG fraasi konstrueerimine
 #'
 #' See funktsioon konstrueerib 'ogr2ogr' käsus kasutatava fraasi, mis on vajalik andmebaasiga ühendamisegs. Fraasi algparameetrid võetakse konfiguratsioonifailist ruut::get_config().
-#' @param conf A list() of configuration variables. Default values \code{\link{get_config}}.
+#' @param conf A list() of configuration variables. Default values \code{\link[ruut]{get_config}}.
 #' @return A string '"PG:dbname='%s' host=%s port=%d user='%s' password='%s' sslmode=%s"'.
 #' @seealso [ruut::db_connect()], [ruut::get_config()]
 #' @keywords ogr2ogr, postgis

+ 5 - 3
R/convert_sf2qgis.R

@@ -1,7 +1,9 @@
-#' Konverteerimine: 'sf' TO 'qgis'
+#' Konverteerimine: 'sf' to 'qgis'
 #'
-#' Funktsioon konverteerib geomeetria 'sf' kujul qgis, et oleks rakendatavad QGIS >= 3.14 tööriist qgisprocess.
-#' @param x	object of class sf, sfc or sfg.
+#' Funktsioon konverteerib geomeetria 'sf' kujul 'qgis_object', et oleks rakendatavad QGIS >= 3.14 tööriist \url{https://github.com/paleolimbot/qgisprocess}. Vaata veel \url{https://r-spatial.github.io/sf/}, \code{\link[sf]{st_is_valid}}.
+#' @param x	object of class 'sf', 'sfc' or 'sfg'.
+#' @return The object with class 'qgis_object'.
+#' @seealso [qgisprocess::qgis_run_algorithm()], [qgisprocess::qgis_output()], [sf::st_is_valid()], [sf::read_sf()]
 #' @keywords sf, qgis
 #' @export
 #' @examples

+ 6 - 4
R/copy_qgis_object_to_db.R

@@ -1,12 +1,14 @@
 #' QGIS objekti kopeerimine andmebaasi
 #'
-#' Funktsioon kopeerib QGIS objeketi postgis andmebaasi. Andmebaasi parameetri muutmiseks muuda konfiguratsiooni muutujat config <- ruut::get_config().
-#' @param x	object of "qgis_result" spatial object.
-#' @param conf	list database configuration. Default get_config()
-#' @param id field andmebaasi unikaalne id veerg. Default 'fid'
+#' Funktsioon kopeerib QGIS objekti ('qgis_object') postgis andmebaasi. Andmebaasi ja konfiguratsiooni muutmiseks muuda konfiguratsiooni muutujat \code{conf}. Vaata \code{\link[ruut]{get_config}}.
+#' @param x	object of 'qgis_result' spatial object.
+#' @param conf A list() of configuration variables. Default values \code{\link[ruut]{get_config}}.
+#' @param id A specified feature id will be processed. Unique field database. Default value 'fid'.
 #' @param crs_source CRS source CRS for example 'EPSG:3301' (Estonia). Default is 'EPSG:4326'.
 #' @param crs_target CRS target CRS for example 'EPSG:4326'. Default is 'EPSG:4326'.
 #' @param geometry_type str Force a geometry type for new layer.  One of: NONE, GEOMETRY, POINT, LINESTRING, POLYGON, GEOMETRYCOLLECTION, MULTIPOINT, MULTIPOLYGON, or MULTILINESTRING, or PROMOTE_TO_MULTI or CONVERT_TO_LINEAR.  Add "25D" for 3D layers.
+#' @return No output.
+#' @seealso [ruut::db_create_new_schema()], [ruut::get_config()], \url{https://gdal.org/programs/ogr2ogr.html}
 #' @keywords postgis, QGIS object
 #' @export
 #' @examples

+ 7 - 5
R/copy_shp_to_db.R

@@ -1,13 +1,15 @@
 #' ESRI Shapefile kopeerimine andmebaasi
 #'
-#' Funktsioon kopeerib ESRI Shapefile objeketi postgis andmebaasi. Andmebaasi parameetri muutmiseks muuda konfiguratsiooni muutujat conf <- ruut::get_conf().
-#' @param dir	path directory of the shape files.
-#' @param layer	str layer name.
-#' @param conf	list database confuration. Default get_conf()
-#' @param id field andmebaasi unikaalne id veerg. Default 'fid'
+#' Funktsioon kopeerib ESRI Shapefile objekti postgis andmebaasi. Andmebaasi ja konfiguratsiooni muutmiseks muuda konfiguratsiooni muutujat \code{conf}. Vaata \code{\link[ruut]{get_config}}.
+#' @param dir	The directory where the shapefiles are located.
+#' @param layer str Layer to use.
+#' @param conf A list() of configuration variables. Default values \code{\link[ruut]{get_config}}.
+#' @param id A specified feature id will be processed. Unique field database. Default value 'fid'.
 #' @param crs_source CRS source CRS for example 'EPSG:3301' (Estonia). Default is 'EPSG:4326'.
 #' @param crs_target CRS target CRS for example 'EPSG:4326'. Default is 'EPSG:4326'.
 #' @param geometry_type str Force a geometry type for new layer.  One of: NONE, GEOMETRY, POINT, LINESTRING, POLYGON, GEOMETRYCOLLECTION, MULTIPOINT, MULTIPOLYGON, or MULTILINESTRING, or PROMOTE_TO_MULTI or CONVERT_TO_LINEAR.  Add "25D" for 3D layers.
+#' @return No output.
+#' @seealso [ruut::db_create_new_schema()], [ruut::get_config()]
 #' @keywords postgis, ESRI Shapefile
 #' @export
 #' @examples

+ 8 - 2
R/db_all_schemas.R

@@ -1,10 +1,16 @@
 #' List of all database schemas
 #'
-#' Valitud andmebaasi kõikide schemade nimekiri.
+#' Andmebaasi kõikide schemade nimekiri.
+#' @return A array of all database schemas.
+#' @seealso [ruut::db_connect()], [ruut::get_config()]
 #' @keywords database, schema
 #' @export
 #' @examples
-#' db_all_schemas()
+#' ## Not run:
+#' ##
+#' ## db_all_schemas()
+#' ##
+#' ## End(**Not run**)
 db_all_schemas <- function() {
   conn <- ruut::db_connect()
   all_schemas <- DBI::dbGetQuery(conn, "SELECT SCHEMA_NAME FROM INFORMATION_SCHEMA.SCHEMATA")

+ 8 - 3
R/db_connect.R

@@ -1,12 +1,17 @@
 #' Connect to database
 #'
 #' Andmebaasiga ühenduse looomine.
-#' @param conf	list List of configuration data. Rewrite it.
+#' @param conf A list() of configuration variables. Default values \code{\link[ruut]{get_config}}.
+#' #' @return Connection to the database.
 #' @keywords database, schema
 #' @export
 #' @examples
-#' config <- get_config()
-#' conn <- db_connect(conf = config)
+#' ## Not run:
+#' ##
+#' ## config <- get_config()
+#' ## conn <- db_connect(conf = config)
+#' ##
+#' ## End(**Not run**)
 db_connect <- function(conf = NULL) {
   if (is.null(conf)) {
     config <- ruut::get_config()

+ 10 - 4
R/db_create_new_schema.R

@@ -1,12 +1,18 @@
 #' Create the new schema
 #'
-#' Loome andmebaasi uue schema.
-#' @param conf	list List of configuration data. Rewrite it.
+#' Loome andmebaasi uue schema. Selleks tuleb schema uus nimi lisada conf muutujale. Konfiguratsiooni algväärtused  \code{\link[ruut]{get_config}}.
+#' @param conf A list() of configuration variables. Default values \code{\link[ruut]{get_config}}.
+#' @return New schema created.
+#' @seealso [ruut::db_connect()], [ruut::get_config()]
 #' @keywords database, schema
 #' @export
 #' @examples
-#' config <- get_config()
-#' db_create_new_schema(conf = config)
+#' ## Not run:
+#' ##
+#' ## config <- get_config()
+#' ## db_create_new_schema(conf = config)
+#' ##
+#' ## End(**Not run**)
 db_create_new_schema <- function(conf) {
   if (!ruut::db_is_shema_exist(conf$schema)) {
     conn <- ruut::db_connect()

+ 9 - 3
R/db_is_shema_exist.R

@@ -1,11 +1,17 @@
 #' Does the schema exist
 #'
-#' Kontrollime kas andmebaasis antud schema eksisteerib.
-#' @param schema	str Database schema name.
+#' Kontrollime kas andmebaasi schema eksisteerib.
+#' @param schema	str A database schema name.
+#' @return TRUE/FALSE.
+#' @seealso [ruut::db_connect()], [ruut::get_config()], [ruut::db_all_schemas()]
 #' @keywords database, schema
 #' @export
 #' @examples
-#' db_is_shema_exist(schema = "public")
+#' ## Not run:
+#' ##
+#' ## db_is_shema_exist(schema = "public")
+#' ##
+#' ## End(**Not run**)
 db_is_shema_exist <- function(schema = NULL) {
   if (schema %in% ruut::db_all_schemas()) {
     TRUE

+ 10 - 5
R/db_table_colnames.R

@@ -1,14 +1,19 @@
 #' Database table columns info
 #'
 #' Andmebaasi tabel veergude nimekiri.
-#' @param conf	list List of configuration data. Rewrite it.
+#' @param conf A list() of configuration variables. Default values \code{\link[ruut]{get_config}}.
+#' @seealso [ruut::db_connect()], [ruut::get_config()]
 #' @keywords database, table
 #' @export
 #' @examples
-#' config <- get_config()
-#' config$schema <- "public"
-#' config$table <- "spatial_ref_sys"
-#' db_table_colnames(conf = config)
+#' ## Not run:
+#' ##
+#' ## config <- get_config()
+#' ## config$schema <- "public"
+#' ## config$table <- "spatial_ref_sys"
+#' ## db_table_colnames(conf = config)
+#' ##
+#' ## End(**Not run**)
 db_table_colnames <- function(conf) {
   conn <- ruut::db_connect()
   q <- sprintf("SELECT

+ 11 - 3
R/get_config.R

@@ -1,12 +1,20 @@
 #' Mooduli konfiguratsioon andmed
 #'
 #' JSONi konfiguratsioon faili lugemine. Muuda seda faili vajadusel. Rakenda seda funktsiooni oma konfiguratsioonifailile. Asendame defaul schema nime "date_YYMMDD" tegeliku tänase kuupäevaga, et ei kirjutaks andmebaasis juhuslikult midagi üle. Oma scema lisamiseks config$schema <- "oma_schema".
-#' @param conf json fail konfiguratsioon muutujate argumentidega.
+#' @param conf A list() of configuration variables. Default values \code{\link[ruut]{get_config}}.
+#' @return A list().
+#' @seealso [ruut::db_connect()], [ruut::get_config()], [ruut::db_all_schemas()]
 #' @keywords cats
 #' @export
 #' @examples
-#' config <- get_config()
-#' config
+#' ## Not run:
+#' ##
+#' ## config <- get_config()
+#' ## config
+#' ## # New schema.
+#' ## config$schema <- "new_schema"
+#' ##
+#' ## End(**Not run**)
 get_config <- function(conf = NULL) {
   if (is.null(conf)) {
     config <- rjson::fromJSON(file = system.file("extdata", "config.json", package = "ruut"))

+ 5 - 4
R/pk_boundary_box.R

@@ -1,8 +1,10 @@
 #' Piirkonna piirikast BB
 #'
-#' Funktsioon leiab etteantud piirkonnale piirikasti (boundary box). Tulemuseks on qgis_vektor.
-#' @param x	object of class sf, sfc or sfg.
+#' Funktsioon leiab etteantud piirkonnale piirikasti (boundary box). Tulemuseks on 'qgis_vector'.
+#' @param x	object of class 'sf', 'sfc' or 'sfg'.
 #' @param type num select value: 1-3. 0: Envelope (Bounding Box), 1: Minimum Oriented Rectangle, 2: Minimum Enclosing Circle, 3: Convex Hull.
+#' @return The object with class 'qgis_object'.
+#' @seealso [qgisprocess::qgis_run_algorithm()], [qgisprocess::qgis_output()], [ruut::get_config()]
 #' @keywords piirkond, boundarybox
 #' @export
 #' @examples
@@ -14,7 +16,7 @@
 #' ##
 #' ## End(**Not run**)
 pk_bbox <- function(x = NULL, type = 0) {
-  if (!is.null(x) && sf::st_is_valid(x) && type %in% (seq(0:3)-1)) {
+  if (!is.null(x) && sf::st_is_valid(x) && type %in% (seq(0:3) - 1)) {
     result <- qgisprocess::qgis_run_algorithm(
       algorithm = "qgis:minimumboundinggeometry",
       INPUT = x,
@@ -27,4 +29,3 @@ pk_bbox <- function(x = NULL, type = 0) {
     NULL
   }
 }
-

+ 4 - 1
R/qgis_algorithm_search_by_word.R

@@ -1,7 +1,10 @@
 #' QGIS-i algoritmi leidmine fraasi järele
 #'
 #' Funktsioon leiab fraasi järele QGIS-i algoritmid.
-#' @param str	string otsitav fras.
+#' @param str	string otsitav algoritmi fraas.
+#' @return Table found algorithms. Help for the selected algorithm.
+#' @return A array of all database schemas.
+#' @seealso [qgisprocess::qgis_algorithms()]
 #' @keywords qgis, help
 #' @export
 #' @examples

+ 9 - 0
inst/abifailid/valikud_examples.R

@@ -0,0 +1,9 @@
+## Examples
+
+
+#' @examples
+#' ## Not run:
+#' ##
+#' ## xxxxxxxxxxxxxxxxx()
+#' ##
+#' ## End(**Not run**)

+ 3 - 0
inst/abifailid/valikud_keywords.R

@@ -0,0 +1,3 @@
+## Keywords
+
+system(sprintf("cat %s",file.path(R.home("doc"), "KEYWORDS")))

+ 35 - 0
inst/abifailid/valikud_params.R

@@ -0,0 +1,35 @@
+## Arguments
+
+# \code{\link{brocolors}}
+
+## Mina:
+
+#' @param dir	The directory where the shapefiles are located.
+#' @param layer str Layer to use.
+#' @param schema	str A database schema name.
+#' @param conf A list() of configuration variables. Default values \code{\link[ruut]{get_config}}.
+#' @param x	object of class 'sf', 'sfc' or 'sfg'.
+#' @param type num select value: 1-3. 0: Envelope (Bounding Box), 1: Minimum Oriented Rectangle, 2: Minimum Enclosing Circle, 3: Convex Hull.
+#' @param x	object of 'qgis_result' spatial object.
+#' @param id A specified feature id will be processed. Unique field database. Default value 'fid'.
+#' @param crs_source CRS source CRS for example 'EPSG:3301' (Estonia). Default is 'EPSG:4326'.
+#' @param crs_target CRS target CRS for example 'EPSG:4326'. Default is 'EPSG:4326'.
+#' @param geometry_type str Force a geometry type for new layer.  One of: NONE, GEOMETRY, POINT, LINESTRING, POLYGON, GEOMETRYCOLLECTION, MULTIPOINT, MULTIPOLYGON, or MULTILINESTRING, or PROMOTE_TO_MULTI or CONVERT_TO_LINEAR.  Add "25D" for 3D layers.
+
+
+
+
+#' @param ... Passed to processx::run().
+#' @param sort	If TRUE, will show the largest groups at the top.
+#' @param env A list() of environment variables. Defaults to qgis_env().
+#' @param path A path to the 'qgis_process' executable. Defaults to qgis_path().
+#' @param action An action to take if the 'qgis_process' executable could not be found.
+#' @param quiet Use FALSE to display more information about the command, possibly useful for debugging.
+#' @param query Use TRUE to refresh the cached value.
+#' @param x	An object passed to a QGIS processing algorithm
+#' @param spec	A list() with values for algorithm, name, description, and qgis_type. See qgis_argument_spec() to create a blank spec for testing.
+#' @param value	The result of as_qgis_argument() after the QGIS processing algorithm has been run.
+#' @param algorithm	A qualified algorithm name (e.g., "native:filedownloader") or a path to a QGIS model file.
+#' @param name, description, qgis_type, available_values, acceptable_values	Column values of arguments denoting the argument name, description, and acceptable values.
+#' @param arguments	The result of qgis_arguments().
+#' @param src	A data source

+ 14 - 0
inst/abifailid/valikud_return.R

@@ -0,0 +1,14 @@
+## Return
+
+## Mina:
+#' @return The object with class 'qgis_object'.
+#' @return No output.
+#' @return A array of all database schemas.
+#' @return Connection to the database.
+#' @return New schema created.
+#' @return TRUE/FALSE.
+
+
+#' @param x A number.
+#' @param y A number.
+#' @return The sum of \code{x} and \code{y}.

+ 14 - 0
inst/abifailid/valikud_seealso.R

@@ -0,0 +1,14 @@
+## Arguments
+
+#' @seealso \code{\link{prod}} for products, \code{\link{cumsum}} for cumulative
+#'   sums, and \code{\link{colSums}}/\code{\link{rowSums}} marginal sums over
+#'   high-dimensional arrays.
+
+
+#' @seealso [ruut::db_connect()], [ruut::get_config()]
+
+
+#' @seealso [ruut::cat_function()], [ruut::construct_ogr2ogr_PG_connect_str()], [ruut::convert_sf2qgis()], [ruut::copy_qgis_object_to_db()], [ruut::copy_shp_to_db()], [ruut::db_all_schemas()], [ruut::db_connect()], [ruut::db_create_new_schema()], [ruut::db_is_shema_exist()], [ruut::db_table_colnames()], [ruut::get_config()], [ruut::pk_boundary_box()], [ruut::qgis_algorithm_search_by_word()]
+#'
+#'
+#' \url{https://gdal.org/programs/ogr2ogr.html}, \url{https://github.com/paleolimbot/qgisprocess}, \url{https://r-spatial.github.io/sf/}

+ 29 - 0
man/construct_ogr2ogr_PG_connect_str.Rd

@@ -0,0 +1,29 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/construct_ogr2ogr_PG_connect_str.R
+\name{construct_ogr2ogr_PG_connect_str}
+\alias{construct_ogr2ogr_PG_connect_str}
+\title{'ogr2ogr' käsus oleva PG fraasi konstrueerimine}
+\usage{
+construct_ogr2ogr_PG_connect_str(conf = NULL)
+}
+\arguments{
+\item{conf}{A list() of configuration variables. Default values \code{\link[ruut]{get_config}}.}
+}
+\value{
+A string '"PG:dbname='\%s' host=\%s port=\%d user='\%s' password='\%s' sslmode=\%s"'.
+}
+\description{
+See funktsioon konstrueerib 'ogr2ogr' käsus kasutatava fraasi, mis on vajalik andmebaasiga ühendamisegs. Fraasi algparameetrid võetakse konfiguratsioonifailist ruut::get_config().
+}
+\examples{
+## Not run:
+##
+## construct_ogr2ogr_PG_connect_str()
+##
+## End(**Not run**)
+}
+\seealso{
+\code{\link[=db_connect]{db_connect()}}, \code{\link[=get_config]{get_config()}}
+}
+\keyword{ogr2ogr,}
+\keyword{postgis}

+ 9 - 3
man/convert_sf2qgis.Rd

@@ -2,15 +2,18 @@
 % Please edit documentation in R/convert_sf2qgis.R
 \name{convert_sf2qgis}
 \alias{convert_sf2qgis}
-\title{Konverteerimine: 'sf' TO 'qgis'}
+\title{Konverteerimine: 'sf' to 'qgis'}
 \usage{
 convert_sf2qgis(x = NULL)
 }
 \arguments{
-\item{x}{object of class sf, sfc or sfg.}
+\item{x}{object of class 'sf', 'sfc' or 'sfg'.}
+}
+\value{
+The object with class 'qgis_object'.
 }
 \description{
-Funktsioon konverteerib geomeetria 'sf' kujul qgis, et oleks rakendatavad QGIS >= 3.14 tööriist qgisprocess.
+Funktsioon konverteerib geomeetria 'sf' kujul 'qgis_object', et oleks rakendatavad QGIS >= 3.14 tööriist \url{https://github.com/paleolimbot/qgisprocess}. Vaata veel \url{https://r-spatial.github.io/sf/}, \code{\link[sf]{st_is_valid}}.
 }
 \examples{
 ## Not run:
@@ -21,5 +24,8 @@ Funktsioon konverteerib geomeetria 'sf' kujul qgis, et oleks rakendatavad QGIS >
 ##
 ## End(**Not run**)
 }
+\seealso{
+\code{\link[qgisprocess:qgis_run_algorithm]{qgisprocess::qgis_run_algorithm()}}, \code{\link[qgisprocess:is_qgis_result]{qgisprocess::qgis_output()}}, \code{\link[sf:valid]{sf::st_is_valid()}}, \code{\link[sf:st_read]{sf::read_sf()}}
+}
 \keyword{qgis}
 \keyword{sf,}

+ 10 - 4
man/copy_qgis_object_to_db.Rd

@@ -14,11 +14,11 @@ copy_qgis_object_to_db(
 )
 }
 \arguments{
-\item{x}{object of "qgis_result" spatial object.}
+\item{x}{object of 'qgis_result' spatial object.}
 
-\item{conf}{list database configuration. Default get_config()}
+\item{conf}{A list() of configuration variables. Default values \code{\link[ruut]{get_config}}.}
 
-\item{id}{field andmebaasi unikaalne id veerg. Default 'fid'}
+\item{id}{A specified feature id will be processed. Unique field database. Default value 'fid'.}
 
 \item{crs_source}{CRS source CRS for example 'EPSG:3301' (Estonia). Default is 'EPSG:4326'.}
 
@@ -26,8 +26,11 @@ copy_qgis_object_to_db(
 
 \item{geometry_type}{str Force a geometry type for new layer.  One of: NONE, GEOMETRY, POINT, LINESTRING, POLYGON, GEOMETRYCOLLECTION, MULTIPOINT, MULTIPOLYGON, or MULTILINESTRING, or PROMOTE_TO_MULTI or CONVERT_TO_LINEAR.  Add "25D" for 3D layers.}
 }
+\value{
+No output.
+}
 \description{
-Funktsioon kopeerib QGIS objeketi postgis andmebaasi. Andmebaasi parameetri muutmiseks muuda konfiguratsiooni muutujat config <- ruut::get_config().
+Funktsioon kopeerib QGIS objekti ('qgis_object') postgis andmebaasi. Andmebaasi ja konfiguratsiooni muutmiseks muuda konfiguratsiooni muutujat \code{conf}. Vaata \code{\link[ruut]{get_config}}.
 }
 \examples{
 ## Not run:
@@ -36,6 +39,9 @@ Funktsioon kopeerib QGIS objeketi postgis andmebaasi. Andmebaasi parameetri muut
 ##
 ## End(**Not run**)
 }
+\seealso{
+\code{\link[=db_create_new_schema]{db_create_new_schema()}}, \code{\link[=get_config]{get_config()}}, \url{https://gdal.org/programs/ogr2ogr.html}
+}
 \keyword{QGIS}
 \keyword{object}
 \keyword{postgis,}

+ 11 - 5
man/copy_shp_to_db.Rd

@@ -15,13 +15,13 @@ copy_shp_to_db(
 )
 }
 \arguments{
-\item{dir}{path directory of the shape files.}
+\item{dir}{The directory where the shapefiles are located.}
 
-\item{layer}{str layer name.}
+\item{layer}{str Layer to use.}
 
-\item{conf}{list database confuration. Default get_conf()}
+\item{conf}{A list() of configuration variables. Default values \code{\link[ruut]{get_config}}.}
 
-\item{id}{field andmebaasi unikaalne id veerg. Default 'fid'}
+\item{id}{A specified feature id will be processed. Unique field database. Default value 'fid'.}
 
 \item{crs_source}{CRS source CRS for example 'EPSG:3301' (Estonia). Default is 'EPSG:4326'.}
 
@@ -29,8 +29,11 @@ copy_shp_to_db(
 
 \item{geometry_type}{str Force a geometry type for new layer.  One of: NONE, GEOMETRY, POINT, LINESTRING, POLYGON, GEOMETRYCOLLECTION, MULTIPOINT, MULTIPOLYGON, or MULTILINESTRING, or PROMOTE_TO_MULTI or CONVERT_TO_LINEAR.  Add "25D" for 3D layers.}
 }
+\value{
+No output.
+}
 \description{
-Funktsioon kopeerib ESRI Shapefile objeketi postgis andmebaasi. Andmebaasi parameetri muutmiseks muuda konfiguratsiooni muutujat conf <- ruut::get_conf().
+Funktsioon kopeerib ESRI Shapefile objekti postgis andmebaasi. Andmebaasi ja konfiguratsiooni muutmiseks muuda konfiguratsiooni muutujat \code{conf}. Vaata \code{\link[ruut]{get_config}}.
 }
 \examples{
 ## Not run:
@@ -39,6 +42,9 @@ Funktsioon kopeerib ESRI Shapefile objeketi postgis andmebaasi. Andmebaasi param
 ##
 ## End(**Not run**)
 }
+\seealso{
+\code{\link[=db_create_new_schema]{db_create_new_schema()}}, \code{\link[=get_config]{get_config()}}
+}
 \keyword{ESRI}
 \keyword{Shapefile}
 \keyword{postgis,}

+ 12 - 2
man/db_all_schemas.Rd

@@ -6,11 +6,21 @@
 \usage{
 db_all_schemas()
 }
+\value{
+A array of all database schemas.
+}
 \description{
-Valitud andmebaasi kõikide schemade nimekiri.
+Andmebaasi kõikide schemade nimekiri.
 }
 \examples{
-db_all_schemas()
+## Not run:
+##
+## db_all_schemas()
+##
+## End(**Not run**)
+}
+\seealso{
+\code{\link[=db_connect]{db_connect()}}, \code{\link[=get_config]{get_config()}}
 }
 \keyword{database,}
 \keyword{schema}

+ 8 - 3
man/db_connect.Rd

@@ -7,14 +7,19 @@
 db_connect(conf = NULL)
 }
 \arguments{
-\item{conf}{list List of configuration data. Rewrite it.}
+\item{conf}{A list() of configuration variables. Default values \code{\link[ruut]{get_config}}.
+#' @return Connection to the database.}
 }
 \description{
 Andmebaasiga ühenduse looomine.
 }
 \examples{
-config <- get_config()
-conn <- db_connect(conf = config)
+## Not run:
+##
+## config <- get_config()
+## conn <- db_connect(conf = config)
+##
+## End(**Not run**)
 }
 \keyword{database,}
 \keyword{schema}

+ 14 - 4
man/db_create_new_schema.Rd

@@ -7,14 +7,24 @@
 db_create_new_schema(conf)
 }
 \arguments{
-\item{conf}{list List of configuration data. Rewrite it.}
+\item{conf}{A list() of configuration variables. Default values \code{\link[ruut]{get_config}}.}
+}
+\value{
+New schema created.
 }
 \description{
-Loome andmebaasi uue schema.
+Loome andmebaasi uue schema. Selleks tuleb schema uus nimi lisada conf muutujale. Konfiguratsiooni algväärtused  \code{\link[ruut]{get_config}}.
 }
 \examples{
-config <- get_config()
-db_create_new_schema(conf = config)
+## Not run:
+##
+## config <- get_config()
+## db_create_new_schema(conf = config)
+##
+## End(**Not run**)
+}
+\seealso{
+\code{\link[=db_connect]{db_connect()}}, \code{\link[=get_config]{get_config()}}
 }
 \keyword{database,}
 \keyword{schema}

+ 13 - 3
man/db_is_shema_exist.Rd

@@ -7,13 +7,23 @@
 db_is_shema_exist(schema = NULL)
 }
 \arguments{
-\item{schema}{str Database schema name.}
+\item{schema}{str A database schema name.}
+}
+\value{
+TRUE/FALSE.
 }
 \description{
-Kontrollime kas andmebaasis antud schema eksisteerib.
+Kontrollime kas andmebaasi schema eksisteerib.
 }
 \examples{
-db_is_shema_exist(schema = "public")
+## Not run:
+##
+## db_is_shema_exist(schema = "public")
+##
+## End(**Not run**)
+}
+\seealso{
+\code{\link[=db_connect]{db_connect()}}, \code{\link[=get_config]{get_config()}}, \code{\link[=db_all_schemas]{db_all_schemas()}}
 }
 \keyword{database,}
 \keyword{schema}

+ 12 - 5
man/db_table_colnames.Rd

@@ -7,16 +7,23 @@
 db_table_colnames(conf)
 }
 \arguments{
-\item{conf}{list List of configuration data. Rewrite it.}
+\item{conf}{A list() of configuration variables. Default values \code{\link[ruut]{get_config}}.}
 }
 \description{
 Andmebaasi tabel veergude nimekiri.
 }
 \examples{
-config <- get_config()
-config$schema <- "public"
-config$table <- "spatial_ref_sys"
-db_table_colnames(conf = config)
+## Not run:
+##
+## config <- get_config()
+## config$schema <- "public"
+## config$table <- "spatial_ref_sys"
+## db_table_colnames(conf = config)
+##
+## End(**Not run**)
+}
+\seealso{
+\code{\link[=db_connect]{db_connect()}}, \code{\link[=get_config]{get_config()}}
 }
 \keyword{database,}
 \keyword{table}

+ 15 - 3
man/get_config.Rd

@@ -7,13 +7,25 @@
 get_config(conf = NULL)
 }
 \arguments{
-\item{conf}{json fail konfiguratsioon muutujate argumentidega.}
+\item{conf}{A list() of configuration variables. Default values \code{\link[ruut]{get_config}}.}
+}
+\value{
+A list().
 }
 \description{
 JSONi konfiguratsioon faili lugemine. Muuda seda faili vajadusel. Rakenda seda funktsiooni oma konfiguratsioonifailile. Asendame defaul schema nime "date_YYMMDD" tegeliku tänase kuupäevaga, et ei kirjutaks andmebaasis juhuslikult midagi üle. Oma scema lisamiseks config$schema <- "oma_schema".
 }
 \examples{
-config <- get_config()
-config
+## Not run:
+##
+## config <- get_config()
+## config
+## # New schema.
+## config$schema <- "new_schema"
+##
+## End(**Not run**)
+}
+\seealso{
+\code{\link[=db_connect]{db_connect()}}, \code{\link[=get_config]{get_config()}}, \code{\link[=db_all_schemas]{db_all_schemas()}}
 }
 \keyword{cats}

+ 8 - 2
man/pk_bbox.Rd

@@ -7,12 +7,15 @@
 pk_bbox(x = NULL, type = 0)
 }
 \arguments{
-\item{x}{object of class sf, sfc or sfg.}
+\item{x}{object of class 'sf', 'sfc' or 'sfg'.}
 
 \item{type}{num select value: 1-3. 0: Envelope (Bounding Box), 1: Minimum Oriented Rectangle, 2: Minimum Enclosing Circle, 3: Convex Hull.}
 }
+\value{
+The object with class 'qgis_object'.
+}
 \description{
-Funktsioon leiab etteantud piirkonnale piirikasti (boundary box). Tulemuseks on qgis_vektor.
+Funktsioon leiab etteantud piirkonnale piirikasti (boundary box). Tulemuseks on 'qgis_vector'.
 }
 \examples{
 ## Not run:
@@ -23,5 +26,8 @@ Funktsioon leiab etteantud piirkonnale piirikasti (boundary box). Tulemuseks on
 ##
 ## End(**Not run**)
 }
+\seealso{
+\code{\link[qgisprocess:qgis_run_algorithm]{qgisprocess::qgis_run_algorithm()}}, \code{\link[qgisprocess:is_qgis_result]{qgisprocess::qgis_output()}}, \code{\link[=get_config]{get_config()}}
+}
 \keyword{boundarybox}
 \keyword{piirkond,}

+ 9 - 1
man/qgis_algorithm_search_by_word.Rd

@@ -7,7 +7,12 @@
 qgis_algorithm_search_by_word(str = NULL)
 }
 \arguments{
-\item{str}{string otsitav fras.}
+\item{str}{string otsitav algoritmi fraas.}
+}
+\value{
+Table found algorithms. Help for the selected algorithm.
+
+A array of all database schemas.
 }
 \description{
 Funktsioon leiab fraasi järele QGIS-i algoritmid.
@@ -27,5 +32,8 @@ Funktsioon leiab fraasi järele QGIS-i algoritmid.
 ##
 ## End(**Not run**)
 }
+\seealso{
+\code{\link[qgisprocess:qgis_run]{qgisprocess::qgis_algorithms()}}
+}
 \keyword{help}
 \keyword{qgis,}