|
|
@@ -1,7 +1,10 @@
|
|
|
-#' 100x100 km kaardiruudukeste genereerimine
|
|
|
+#' Kõikide kaardiruudukeste genereerimine
|
|
|
#'
|
|
|
-#' Eesti projektsioonile vastava ning kogu Eestit katva ruutvõrgustiku genereerimine ja salvestamine andmebaasi. Ruutvõrgustiku ruudu suurus 100x100 km. Võrgustik salvestatakse vaikimisi andmebaasi nime 'maaamet.epk200t_grid' alla.Loe: \url{https://geoportaal.maaamet.ee/est/Ruumiandmed/Kaardilehtede-susteemid-p224.html}. Koniguratsiooni muutmiseks muuda konfiguratsiooni. Muutujate vaikeväärtused on sellised, et ei ole vaja midagi muuta.
|
|
|
-#' @param output str See on salvestamise string sõltuvalt millisele kujule soovitakse ruudustikke salvestada. Vaata 'gpkg' kujule \code{\link[ruut]{construct_to_gpkg_output_file_str}} või 'postgis' andmebaasi \code{\link[ruut]{construct_to_gpkg_output_postgres_str}}.
|
|
|
+#' Eesti projektsioonile vastava ning kogu Eestit katva ruutvõrgustiku genereerimine ja salvestamine andmebaasi. Valikud on 'postgis' ja 'gpkg'. Ruutvõrgustike ruutude suuruse on 100x100 km, 5x5 km, 1x1 km ja 100x100 mmeetrid, lisaks ruudukastide piirjoon.. Võrgustik salvestatakse vaikimisi andmebaasi nime postgisi andmebaasi 'data' schema 'maaamet' alla või gpkg andmebaasid kataloogi '/data/gpkg'. Loe: \url{https://geoportaal.maaamet.ee/est/Ruumiandmed/Kaardilehtede-susteemid-p224.html}. Koniguratsiooni muutmiseks muuda konfiguratsiooni faili.
|
|
|
+#' @param conf A list() of configuration variables. Default values \code{\link[ruut]{get_config}}.
|
|
|
+#' @param output_format format_name: output file format name, possible values are:
|
|
|
+#' - "GPKG"
|
|
|
+#' - "PostgreSQL" (Default)
|
|
|
#' @return String.
|
|
|
#' @seealso [ruut::get_config()], [ruut::construct_to_gpkg_output_file_str()], [ruut::construct_to_gpkg_output_postgres_str()]
|
|
|
#' @keywords postgis, gpkg
|
|
|
@@ -14,19 +17,28 @@
|
|
|
#' conf$schema <- "maaamet"
|
|
|
#' conf$table <- "epk200t_bb"
|
|
|
#' output <- ruut::construct_to_gpkg_output_postgres_str(conf = conf)
|
|
|
+#' epk_grids(conf = conf, output_format = "PostgreSQL")
|
|
|
#'
|
|
|
#' # GPKG output
|
|
|
-#' gpkg_home <- "/data/gpkg/artiklid/artikkel_210127_valga_matsalu_lahemaa"
|
|
|
-#' gpkg_file <- "ruudud"
|
|
|
-#' gpkg_table <- "epk200t_bb"
|
|
|
-#' output <- ruut::construct_to_gpkg_output_file_str(gpkg_home = gpkg_home,
|
|
|
-#' gpkg_file = gpkg_file, gpkg_table = gpkg_table)
|
|
|
-#'
|
|
|
-#' epk_grids(output = output)
|
|
|
+#' conf <- ruut::get_config()
|
|
|
+#' conf$gpkg_home <- "/data/gpkg/artiklid/artikkel_210127_valga_matsalu_lahemaa"
|
|
|
+#' conf$gpkg_file <- "ruudud"
|
|
|
+#' conf$gpkg_table <- "epk200t_bb"
|
|
|
+#' output <- ruut::construct_to_gpkg_output_file_str(conf = conf)
|
|
|
+#' epk_grids(conf = conf, output_format = "GPKG")
|
|
|
#' }
|
|
|
-epk_grids <- function(output = NULL) {
|
|
|
- if (!exists("conf")) conf <- NULL
|
|
|
- conf$table <- gpkg_table <- "epk200t_bb"
|
|
|
+epk_grids <- function(conf = NULL, output_format = "PostgreSQL") {
|
|
|
+ # Export to postgis
|
|
|
+ if (is.null(conf)) {
|
|
|
+ conf <- ruut::get_config()
|
|
|
+ conf$schema <- "maaamet"
|
|
|
+ conf$gpkg_home <- "/data/gpkg"
|
|
|
+ conf$gpkg_file <- "ruudud"
|
|
|
+ }
|
|
|
+
|
|
|
+ conf$table <- conf$gpkg_table <- "epk200t_bb"
|
|
|
+ if (tolower(output_format) == "postgresql") output <- ruut::construct_to_gpkg_output_postgres_str(conf = conf)
|
|
|
+ if (tolower(output_format) == "gpkg") output <- ruut::construct_to_gpkg_output_file_str(conf = conf)
|
|
|
# ruut::qgis_algorithm_search_by_word(str = "grid")
|
|
|
algorithm <- "native:creategrid"
|
|
|
# cat(qgisprocess::qgis_show_help(algorithm = algorithm))
|
|
|
@@ -42,7 +54,9 @@ epk_grids <- function(output = NULL) {
|
|
|
VSPACING = 400000
|
|
|
# .quiet = TRUE
|
|
|
)
|
|
|
- conf$table <- gpkg_table <- "epk200t_grid"
|
|
|
+ conf$table <- conf$gpkg_table <- "epk200t_grid"
|
|
|
+ if (tolower(output_format) == "postgresql") output <- ruut::construct_to_gpkg_output_postgres_str(conf = conf)
|
|
|
+ if (tolower(output_format) == "gpkg") output <- ruut::construct_to_gpkg_output_file_str(conf = conf)
|
|
|
result <- qgisprocess::qgis_run_algorithm(
|
|
|
algorithm = algorithm,
|
|
|
CRS = "EPSG:3301",
|
|
|
@@ -55,7 +69,9 @@ epk_grids <- function(output = NULL) {
|
|
|
VSPACING = 100000
|
|
|
# .quiet = TRUE
|
|
|
)
|
|
|
- conf$table <- gpkg_table <- "epk2t_grid"
|
|
|
+ conf$table <- conf$gpkg_table <- "epk2t_grid"
|
|
|
+ if (tolower(output_format) == "postgresql") output <- ruut::construct_to_gpkg_output_postgres_str(conf = conf)
|
|
|
+ if (tolower(output_format) == "gpkg") output <- ruut::construct_to_gpkg_output_file_str(conf = conf)
|
|
|
result <- qgisprocess::qgis_run_algorithm(
|
|
|
algorithm = algorithm,
|
|
|
CRS = "EPSG:3301",
|
|
|
@@ -68,7 +84,9 @@ epk_grids <- function(output = NULL) {
|
|
|
VSPACING = 1000
|
|
|
# .quiet = TRUE
|
|
|
)
|
|
|
- conf$table <- gpkg_table <- "epk10t_grid"
|
|
|
+ conf$table <- conf$gpkg_table <- "epk10t_grid"
|
|
|
+ if (tolower(output_format) == "postgresql") output <- ruut::construct_to_gpkg_output_postgres_str(conf = conf)
|
|
|
+ if (tolower(output_format) == "gpkg") output <- ruut::construct_to_gpkg_output_file_str(conf = conf)
|
|
|
result <- qgisprocess::qgis_run_algorithm(
|
|
|
algorithm = algorithm,
|
|
|
CRS = "EPSG:3301",
|
|
|
@@ -81,8 +99,9 @@ epk_grids <- function(output = NULL) {
|
|
|
VSPACING = 5000
|
|
|
# .quiet = TRUE
|
|
|
)
|
|
|
- conf$table <- gpkg_table <- "epk02t_grid"
|
|
|
- output <- ruut::construct_to_gpkg_output_postgres_str(conf = conf)
|
|
|
+ conf$table <- conf$gpkg_table <- "epk02t_grid"
|
|
|
+ if (tolower(output_format) == "postgresql") output <- ruut::construct_to_gpkg_output_postgres_str(conf = conf)
|
|
|
+ if (tolower(output_format) == "gpkg") output <- ruut::construct_to_gpkg_output_file_str(conf = conf)
|
|
|
result <- qgisprocess::qgis_run_algorithm(
|
|
|
algorithm = algorithm,
|
|
|
CRS = "EPSG:3301",
|