|
|
@@ -68,51 +68,33 @@ gpkg_piirkonnale_polygoonide_lisamine <- function(obj = NULL, gpkg_home = "/tmp"
|
|
|
)
|
|
|
## !!! Trikk: alguses leiame ühisosaga piirkonnad
|
|
|
## ------------------- QGIS: qgisprocess ----------------------
|
|
|
- str <- paste0("{ 'INPUT' : '", input, "', 'INTERSECT' : '", intersect_layer, "', 'OUTPUT' : '", tmp_gpkg_file_output, "', 'PREDICATE' : [0] }")
|
|
|
+ str <- paste0("{ 'INPUT' : '", input, "', 'INTERSECT' : '", intersect_layer, "', 'OUTPUT' : '", tmp_gpkg_file, "', 'PREDICATE' : [0] }")
|
|
|
algorithm <- "native:extractbylocation"
|
|
|
cmd <- ruut::construct_qgis_output_result_to_better_format(str = str, algorithm = algorithm)
|
|
|
cat(sprintf("\n%s\n", cmd))
|
|
|
system(cmd)
|
|
|
## !!! Trikk jätkub: edasi leiame alles ühisosa
|
|
|
- str <- paste0("{ 'INPUT' : '", tmp_gpkg_file_input, "', 'OVERLAY' : '", intersect_layer, "', 'OUTPUT' : '", output, "', 'INPUT_FIELDS' : '', 'OVERLAY_FIELDS' : '', 'OVERLAY_FIELDS_PREFIX' : '' }")
|
|
|
- str <- paste0("{ 'INPUT' : '", tmp_gpkg_file_input, "', 'INPUT_FIELDS' : ['id','osm_id','code','fclass','name'], 'OUTPUT' : '", output, "', 'OVERLAY' : '", intersect_layer, "', 'OVERLAY_FIELDS' : ['fid','id','left','top','right','bottom'], 'OVERLAY_FIELDS_PREFIX' : '' }")
|
|
|
+ str <- paste0("{ 'INPUT' : '", tmp_gpkg_file, "', 'OVERLAY' : '", intersect_layer, "', 'OUTPUT' : '", output, "', 'INPUT_FIELDS' : '', 'OVERLAY_FIELDS' : '', 'OVERLAY_FIELDS_PREFIX' : '' }")
|
|
|
+ str <- paste0("{ 'INPUT' : '", tmp_gpkg_file_input, "', 'INPUT_FIELDS' : [], 'OUTPUT' : '", output, "', 'OVERLAY' : '", intersect_layer, "', 'OVERLAY_FIELDS' : [], 'OVERLAY_FIELDS_PREFIX' : '' }")
|
|
|
algorithm <- "native:intersection"
|
|
|
cmd <- ruut::construct_qgis_output_result_to_better_format(str = str, algorithm = algorithm)
|
|
|
cat(sprintf("\n%s\n", cmd))
|
|
|
system(cmd)
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
## Filtreerime maakasutuse kihi 'landuse-a' eraldi alamkihtideks
|
|
|
if (andmed$table[i] == "landuse_a") {
|
|
|
landuse_a <- unique(as.data.frame(sf::read_sf(dsn = dsn, layer = sprintf("%s_landuse_a", intersect), as_tibble = T))[, c("code", "fclass")])
|
|
|
parent_table <- conf$gpkg_table
|
|
|
for (k in 1:nrow(landuse_a)) {
|
|
|
table_suffix <- landuse_a$fclass[k]
|
|
|
- conf$gpkg_table <- sprintf("%s_%s", parent_table, table_suffix)
|
|
|
+ conf$gpkg_table <- parent_table
|
|
|
input <- ruut::construct_to_gpkg_output_file_str(conf = conf, is_input_str = TRUE)
|
|
|
- sprintf("%s_%s",conf$gpkg_table, table_suffix)
|
|
|
+ conf$gpkg_table <- sprintf("%s_%s",conf$gpkg_table, table_suffix)
|
|
|
output <- ruut::construct_to_gpkg_output_file_str(conf = conf, is_input_str = FALSE)
|
|
|
- str <- paste0("{ 'INPUT' : '", input, "', 'INTERSECT' : '", intersect_layer, "', 'OUTPUT' : '", tmp_gpkg_file, "', FIELD : 'code', OPERATOR : 0, VALUE : '", landuse_a$code[k], "' }")
|
|
|
+ str <- paste0("{ 'INPUT' : '", input, "', 'INTERSECT' : '", intersect_layer, "', 'OUTPUT' : '", output, "', FIELD : 'code', OPERATOR : 0, VALUE : '", landuse_a$code[k], "' }")
|
|
|
algorithm <- "native:extractbyattribute"
|
|
|
cmd <- ruut::construct_qgis_output_result_to_better_format(str = str, algorithm = algorithm)
|
|
|
cat(sprintf("\n%s\n", cmd))
|
|
|
system(cmd)
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- result <- qgisprocess::qgis_run_algorithm(
|
|
|
- algorithm = "native:extractbyattribute",
|
|
|
- FIELD = "code",
|
|
|
- OPERATOR = 0, # 0 s.o '='
|
|
|
- VALUE = landuse_a$code[k],
|
|
|
- INPUT = sprintf("%s|layername=%s_%s", dsn, intersect, andmed$table[i]),
|
|
|
- OUTPUT = output,
|
|
|
- FAIL_OUTPUT = qgisprocess::qgis_tmp_vector()
|
|
|
- # .quiet = TRUE
|
|
|
- )
|
|
|
}
|
|
|
}
|
|
|
}
|