فهرست منبع

Täiendused 'gpkg_piirkonnale_polygoonide_lisamine'.

Ardo Kubjas 5 سال پیش
والد
کامیت
4495b623e2
1فایلهای تغییر یافته به همراه22 افزوده شده و 5 حذف شده
  1. 22 5
      R/gpkg_piirkonnale_polygoonide_lisamine.R

+ 22 - 5
R/gpkg_piirkonnale_polygoonide_lisamine.R

@@ -54,16 +54,16 @@ gpkg_piirkonnale_polygoonide_lisamine <- function(obj = NULL, gpkg_home = "/tmp"
   andmed <- rbind(andmed, data.frame("schema" = "osm_shp", "table" = "pofw_a"))
   andmed <- rbind(andmed, data.frame("schema" = "osm_shp", "table" = "pois_a"))
   andmed <- rbind(andmed, data.frame("schema" = "osm_shp", "table" = "natural_a"))
-  andmed <- rbind(andmed, data.frame("schema" = "eesti", "table" = "e_201_meri_a"))
-  andmed <- rbind(andmed, data.frame("schema" = "eesti", "table" = "e_202_seisuveekogu_a"))
-  andmed <- rbind(andmed, data.frame("schema" = "eesti", "table" = "e_203_vooluveekogu_a"))
+  andmed <- rbind(andmed, data.frame("schema" = "eesti", "table" = "e_201_meri_a_dissolved"))
+  andmed <- rbind(andmed, data.frame("schema" = "eesti", "table" = "e_202_seisuveekogu_a_dissolved"))
+  andmed <- rbind(andmed, data.frame("schema" = "eesti", "table" = "e_203_vooluveekogu_a_dissolved"))
   andmed <- rbind(andmed, data.frame("schema" = "eesti", "table" = "e_301_muu_kolvik_a"))
   andmed <- rbind(andmed, data.frame("schema" = "eesti", "table" = "e_301_muu_kolvik_ka"))
   andmed <- rbind(andmed, data.frame("schema" = "eesti", "table" = "e_302_ou_a"))
   andmed <- rbind(andmed, data.frame("schema" = "eesti", "table" = "e_303_haritav_maa_a"))
   andmed <- rbind(andmed, data.frame("schema" = "eesti", "table" = "e_304_lage_a"))
-  andmed <- rbind(andmed, data.frame("schema" = "eesti", "table" = "e_305_puittaimestik_a"))
-  andmed <- rbind(andmed, data.frame("schema" = "eesti", "table" = "e_306_margala_a"))
+  andmed <- rbind(andmed, data.frame("schema" = "eesti", "table" = "e_305_puittaimestik_a_dissolved"))
+  andmed <- rbind(andmed, data.frame("schema" = "eesti", "table" = "e_306_margala_a_dissolved"))
   andmed <- rbind(andmed, data.frame("schema" = "eesti", "table" = "e_306_margala_ka"))
   andmed <- rbind(andmed, data.frame("schema" = "eesti", "table" = "e_307_turbavali_a"))
   andmed <- rbind(andmed, data.frame("schema" = "eesti", "table" = "e_401_hoone_ka"))
@@ -116,6 +116,23 @@ gpkg_piirkonnale_polygoonide_lisamine <- function(obj = NULL, gpkg_home = "/tmp"
           system(cmd)
         }
       }
+      ## Filtreerime hoonete kihi 'landuse-a' eraldi tüübi järele alamkihtideks
+      if (andmed$table[i] == "e_401_hoone_ka") {
+        alamobjektid <- unique(as.data.frame(sf::read_sf(dsn = dsn, layer = sprintf("%s_e_401_hoone_ka", intersect), as_tibble = T), drop = FALSE)[, c("kood", "tyyp")])
+        parent_table <- conf$gpkg_table
+        for (k in 1:nrow(alamobjektid)) {
+          table_suffix <- alamobjektid$tyyp[k]
+          conf$gpkg_table <- parent_table
+          input <- ruut::construct_to_gpkg_output_file_str(conf = conf, is_input_str = TRUE)
+          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' : '", output, "', FIELD : 'tyyp', OPERATOR : 0, VALUE : '", alamobjektid$tyyp[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)
+        }
+      }
     }
   }
   ## Layers list