Sfoglia il codice sorgente

pk_teisendame_polygoone muutmine.

Ardo Kubjas 3 anni fa
parent
commit
ba7552fad0
1 ha cambiato i file con 4 aggiunte e 3 eliminazioni
  1. 4 3
      R/pk_teisendame_polygoone.R

+ 4 - 3
R/pk_teisendame_polygoone.R

@@ -86,13 +86,13 @@ pk_teisendame_polygoone <- function(obj = NULL, conf = NULL) {
       input <- vars$tmp_gpkg_file_input_1 # ajutine fail
       epk02t_table_name <- sprintf("epk02t_%s", gsub("^data_", "", layer_name))
       conf$table <- epk02t_table_name
-      output <- ruut::construct_to_gpkg_output_postgres_str(conf = conf, geometry_field = "geom", geometry_type = "Polygon", srid = 3301, checkPrimaryKeyUnicity = FALSE, key = "id")
+      output <- ruut::construct_to_gpkg_output_postgres_str(conf = conf, geometry_field = "geom", geometry_type = "MultiPolygon", srid = 3301, checkPrimaryKeyUnicity = FALSE, key = "id")
       str <- sprintf("{ 'FIELD_NAME' : 'area_pc', 'FIELD_TYPE' : 1, 'FIELD_LENGTH' : 4, 'FIELD_PRECISION' : 2, 'GLOBAL' : '', 'FORMULA' : 'value = round($geom.area()/10000,3)', 'INPUT' : '%s', 'OUTPUT' : '%s' }", input, output)
       cmd <- ruut::construct_qgis_output_result_to_better_format(str = str, algorithm = algorithm)
       system(cmd)
 
       ## ------------- TIFF ----------------
-      ## 5. Lisame pindade pindalad ja perimeetri ruutudele
+      ## 5. Ühendame ruudud asukoha atribuutide järele.
       # ruut::qgis_algorithm_search_by_word("attributes")
       algorithm <- "native:joinattributesbylocation"
       conf$table <- "bb2_epk02t_grid"
@@ -121,7 +121,7 @@ pk_teisendame_polygoone <- function(obj = NULL, conf = NULL) {
       algorithm <- "native:deletecolumn"
       input <- vars$tmp_gpkg_file_input_2
       conf$table <- sprintf("grid_%s", gsub("^data_", "", layer_name))
-      output <- ruut::construct_to_gpkg_output_postgres_str(conf = conf, geometry_field = "geom", geometry_type = "Polygon", srid = 3301, checkPrimaryKeyUnicity = FALSE, key = "fid")
+      output <- ruut::construct_to_gpkg_output_postgres_str(conf = conf, geometry_field = "geom", geometry_type = "MultiPolygon", srid = 3301, checkPrimaryKeyUnicity = FALSE, key = "fid")
       cmd <- sprintf("qgis_process run %s --COLUMN='area_pc' --INPUT='%s' --OUTPUT='%s' ", algorithm, input, output)
       system(cmd)
 
@@ -144,6 +144,7 @@ pk_teisendame_polygoone <- function(obj = NULL, conf = NULL) {
       system(cmd) # Salvestame kataloogi
 
       ## 9. ----------- TIF TO POSTGIS -------------
+      # Installi eelnevalt andmebaasi laiendus: create extension postgis_raster;
       (cmd <- sprintf(
         "export PGPASSWORD=%s && raster2pgsql -s 3301 -d -I -C -M %s %s.%s_tif | psql -U %s -d %s -h %s -p %s",
         conf$password, output, conf$schema, tif_file_name, conf$user, conf$dbname, conf$host, conf$port