|
|
@@ -16,7 +16,7 @@
|
|
|
#' conf <- ruut::get_config()
|
|
|
#' conf$schema <- "maaamet"
|
|
|
#' conf$table <- "epk200t_bb"
|
|
|
-#' output <- ruut::construct_to_gpkg_output_postgres_str(conf = conf)
|
|
|
+#' output <- ruut::construct_to_gpkg_output_postgres_str(conf = conf, key = "id")
|
|
|
#' epk_grids(conf = conf, output_format = "PostgreSQL")
|
|
|
#'
|
|
|
#' # GPKG output
|
|
|
@@ -34,85 +34,41 @@ epk_grids <- function(conf = NULL, output_format = "PostgreSQL") {
|
|
|
conf$schema <- "maaamet"
|
|
|
conf$gpkg_home <- "/data/gpkg"
|
|
|
conf$gpkg_file <- "ruudud"
|
|
|
+ conf$primary_key <- "id"
|
|
|
}
|
|
|
|
|
|
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) == "postgresql") output <- ruut::construct_to_gpkg_output_postgres_str(conf = conf, key = "id")
|
|
|
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))
|
|
|
- result <- qgisprocess::qgis_run_algorithm(
|
|
|
- algorithm = algorithm,
|
|
|
- CRS = "EPSG:3301",
|
|
|
- EXTENT = "300000.000000000,800000.000000000,6300000.000000000,6700000.000000000 [EPSG=3301]",
|
|
|
- HOVERLAY = 0,
|
|
|
- HSPACING = 500000,
|
|
|
- OUTPUT = output,
|
|
|
- TYPE = 2,
|
|
|
- VOVERLAY = 0,
|
|
|
- VSPACING = 400000
|
|
|
- # .quiet = TRUE
|
|
|
- )
|
|
|
+ # ruut::qgis_show_help(algorithm = algorithm)
|
|
|
+ str <- sprintf("{ 'CRS' : 'epsg:3301', 'EXTENT' : '300000.000000000,800000.000000000,6300000.000000000,6700000.000000000 [EPSG:3301]', 'HOVERLAY' : 0, 'HSPACING' : 500000, 'OUTPUT' : '%s', 'TYPE' : 2, 'VOVERLAY' : 0, 'VSPACING' : 400000 }", output)
|
|
|
+ cmd <- ruut::construct_qgis_output_result_to_better_format(str = str, algorithm = algorithm)
|
|
|
+ system(cmd)
|
|
|
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) == "postgresql") output <- ruut::construct_to_gpkg_output_postgres_str(conf = conf, key = "id")
|
|
|
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",
|
|
|
- EXTENT = "300000.000000000,800000.000000000,6300000.000000000,6700000.000000000 [EPSG=3301]",
|
|
|
- HOVERLAY = 0,
|
|
|
- HSPACING = 100000,
|
|
|
- OUTPUT = output,
|
|
|
- TYPE = 2,
|
|
|
- VOVERLAY = 0,
|
|
|
- VSPACING = 100000
|
|
|
- # .quiet = TRUE
|
|
|
- )
|
|
|
+ str <- sprintf("{ 'CRS' : 'epsg:3301', 'EXTENT' : '300000.000000000,800000.000000000,6300000.000000000,6700000.000000000 [EPSG:3301]', 'HOVERLAY' : 0, 'HSPACING' : 100000, 'OUTPUT' : '%s', 'TYPE' : 2, 'VOVERLAY' : 0, 'VSPACING' : 100000 }", output)
|
|
|
+ cmd <- ruut::construct_qgis_output_result_to_better_format(str = str, algorithm = algorithm)
|
|
|
+ system(cmd)
|
|
|
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) == "postgresql") output <- ruut::construct_to_gpkg_output_postgres_str(conf = conf, key = "id")
|
|
|
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",
|
|
|
- EXTENT = "300000.000000000,800000.000000000,6300000.000000000,6700000.000000000 [EPSG=3301]",
|
|
|
- HOVERLAY = 0,
|
|
|
- HSPACING = 1000,
|
|
|
- OUTPUT = output,
|
|
|
- TYPE = 2,
|
|
|
- VOVERLAY = 0,
|
|
|
- VSPACING = 1000
|
|
|
- # .quiet = TRUE
|
|
|
- )
|
|
|
+ str <- sprintf("{ 'CRS' : 'epsg:3301', 'EXTENT' : '300000.000000000,800000.000000000,6300000.000000000,6700000.000000000 [EPSG:3301]', 'HOVERLAY' : 0, 'HSPACING' : 1000, 'OUTPUT' : '%s', 'TYPE' : 2, 'VOVERLAY' : 0, 'VSPACING' : 1000 }", output)
|
|
|
+ cmd <- ruut::construct_qgis_output_result_to_better_format(str = str, algorithm = algorithm)
|
|
|
+ system(cmd)
|
|
|
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) == "postgresql") output <- ruut::construct_to_gpkg_output_postgres_str(conf = conf, key = "id")
|
|
|
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",
|
|
|
- EXTENT = "300000.000000000,800000.000000000,6300000.000000000,6700000.000000000 [EPSG=3301]",
|
|
|
- HOVERLAY = 0,
|
|
|
- HSPACING = 5000,
|
|
|
- OUTPUT = output,
|
|
|
- TYPE = 2,
|
|
|
- VOVERLAY = 0,
|
|
|
- VSPACING = 5000
|
|
|
- # .quiet = TRUE
|
|
|
- )
|
|
|
+ str <- sprintf("{ 'CRS' : 'epsg:3301', 'EXTENT' : '300000.000000000,800000.000000000,6300000.000000000,6700000.000000000 [EPSG:3301]', 'HOVERLAY' : 0, 'HSPACING' : 5000, 'OUTPUT' : '%s', 'TYPE' : 2, 'VOVERLAY' : 0, 'VSPACING' : 5000 }", output)
|
|
|
+ cmd <- ruut::construct_qgis_output_result_to_better_format(str = str, algorithm = algorithm)
|
|
|
+ system(cmd)
|
|
|
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) == "postgresql") output <- ruut::construct_to_gpkg_output_postgres_str(conf = conf, key = "id")
|
|
|
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",
|
|
|
- EXTENT = "300000.000000000,800000.000000000,6300000.000000000,6700000.000000000 [EPSG=3301]",
|
|
|
- HOVERLAY = 0,
|
|
|
- HSPACING = 100,
|
|
|
- OUTPUT = output,
|
|
|
- TYPE = 2,
|
|
|
- VOVERLAY = 0,
|
|
|
- VSPACING = 100
|
|
|
- # .quiet = TRUE
|
|
|
- )
|
|
|
+ str <- sprintf("{ 'CRS' : 'epsg:3301', 'EXTENT' : '300000.000000000,800000.000000000,6300000.000000000,6700000.000000000 [EPSG:3301]', 'HOVERLAY' : 0, 'HSPACING' : 100, 'OUTPUT' : '%s', 'TYPE' : 2, 'VOVERLAY' : 0, 'VSPACING' : 100 }", output)
|
|
|
+ cmd <- ruut::construct_qgis_output_result_to_better_format(str = str, algorithm = algorithm)
|
|
|
+ system(cmd)
|
|
|
cat(sprintf("\nAndmed salvestati asukohta: %s.\n\n", output))
|
|
|
}
|