Ardo Kubjas il y a 5 ans
Parent
commit
3594aa4257

+ 4 - 1
R/gpkg_piirkonnale_joonte_lisamine.R

@@ -57,15 +57,18 @@ gpkg_piirkonnale_joonte_lisamine <- function(obj = NULL, gpkg_home = "/tmp") {
   andmed <- rbind(andmed, data.frame("schema" = "teeregister_wfs", "table" = "n_omand"))
   andmed <- rbind(andmed, data.frame("schema" = "gtfs", "table" = "shapes"))
   for (intersect in intersect_layers) {
+    conf$gpkg_table <- intersect
     intersect_layer <- ruut::construct_to_gpkg_output_file_str(conf = conf, is_input_str = T)
     for (i in 1:nrow(andmed)) {
+      ## teeregister_wfs andmebaasis on importimisel geomeetria välja tähistus 'geometry'.
+      if (andmed$schema[i] %in% c("teeregister_wfs")) geom <- "geometry" else geom <- "geom"
       conf$gpkg_table <- sprintf("%s_%s", intersect, andmed$table[i])
       conf$table <- andmed$table[i]
       conf$schema <- andmed$schema[i]
       output <- ruut::construct_to_gpkg_output_file_str(conf = conf, is_input_str = F)
       input <- ruut::construct_to_gpkg_output_postgres_str(
         conf = conf, geometry_type = "Linestring", srid = 3301,
-        checkPrimaryKeyUnicity = TRUE, key = "id"
+        checkPrimaryKeyUnicity = TRUE, key = "id", geometry_field = geom
       )
       ## !!! Trikk: alguses leiame ühisosaga piirkonnad
       ## !!! Trikk: alguses leiame ühisosaga piirkonnad

+ 2 - 1
R/gpkg_piirkonnale_polygoonide_lisamine.R

@@ -54,6 +54,7 @@ gpkg_piirkonnale_polygoonide_lisamine <- function(obj = NULL, gpkg_home = "/tmp"
   andmed <- rbind(andmed, data.frame("schema" = "osm_shp", "table" = "pois_a"))
   andmed <- rbind(andmed, data.frame("schema" = "osm_shp", "table" = "natural_a"))
   for (intersect in intersect_layers) {
+    conf$gpkg_table <- intersect
     intersect_layer <- ruut::construct_to_gpkg_output_file_str(conf = conf, is_input_str = T)
     for (i in 1:nrow(andmed)) {
       conf$gpkg_table <- sprintf("%s_%s", intersect, andmed$table[i])
@@ -62,7 +63,7 @@ gpkg_piirkonnale_polygoonide_lisamine <- function(obj = NULL, gpkg_home = "/tmp"
       output <- ruut::construct_to_gpkg_output_file_str(conf = conf, is_input_str = F)
       input <- ruut::construct_to_gpkg_output_postgres_str(
         conf = conf, geometry_type = "Polygon", srid = 3301,
-        checkPrimaryKeyUnicity = TRUE, key = "id"
+        checkPrimaryKeyUnicity = TRUE, key = "id", geometry_field = geom
       )
       ## !!! Trikk: alguses leiame ühisosaga piirkonnad
       ## ------------------- QGIS: qgisprocess ----------------------

+ 2 - 1
R/gpkg_piirkonnale_punktide_lisamine.R

@@ -61,6 +61,7 @@ gpkg_piirkonnale_punktide_lisamine <- function(obj = NULL, gpkg_home = "/tmp") {
   andmed <- rbind(andmed, data.frame("schema" = "teeregister_wfs", "table" = "n_teeosa_points"))
   andmed <- rbind(andmed, data.frame("schema" = "teeregister_wfs", "table" = "n_ylek"))
   for (intersect in intersect_layers) {
+    conf$gpkg_table <- intersect
     intersect_layer <- ruut::construct_to_gpkg_output_file_str(conf = conf, is_input_str = T)
     for (i in 1:nrow(andmed)) {
       ## teeregister_wfs andmebaasis on importimisel geomeetria välja tähistus 'geometry'.
@@ -71,7 +72,7 @@ gpkg_piirkonnale_punktide_lisamine <- function(obj = NULL, gpkg_home = "/tmp") {
       output <- ruut::construct_to_gpkg_output_file_str(conf = conf, is_input_str = F)
       input <- ruut::construct_to_gpkg_output_postgres_str(
         conf = conf, geometry_type = "Point", srid = 3301,
-        checkPrimaryKeyUnicity = TRUE, key = "id"
+        checkPrimaryKeyUnicity = TRUE, key = "id", geometry_field = geom
       )
       ## ------------------- QGIS: qgisprocess ----------------------
       str <- paste0("{ 'INPUT' : '", input, "', 'INTERSECT' : '", intersect_layer, "', 'OUTPUT' : '", output, "', 'PREDICATE' : [0] }")