|
|
@@ -33,6 +33,7 @@ gpkg_piirkonnale_polygoonide_lisamine <- function(obj = NULL, gpkg_home = "/tmp"
|
|
|
"postgres://dbname=\'%s\' host=%s port=%s user=\'%s\' sslmode=%s password=\'%s\' key=\'id\' srid=3301 type=Polygon checkPrimaryKeyUnicity=\'1\' ",
|
|
|
conf$dbname, conf$host, conf$port, conf$user, conf$sslmode, conf$password
|
|
|
)
|
|
|
+ tmp_gpkg_file <- tempfile(fileext = ".gpkg")
|
|
|
## Algorithm
|
|
|
# ruut::qgis_algorithm_search_by_word(str = "extract")
|
|
|
# algorithm <- "native:extractbylocation"
|
|
|
@@ -47,22 +48,26 @@ gpkg_piirkonnale_polygoonide_lisamine <- function(obj = NULL, gpkg_home = "/tmp"
|
|
|
for (i in 1:nrow(andmed)) {
|
|
|
conf$gpkg_table <- sprintf("%s_%s", intersect, andmed$table[i])
|
|
|
output <- ruut::construct_to_gpkg_output_file_str(conf = conf)
|
|
|
- # result <- qgisprocess::qgis_run_algorithm(
|
|
|
- # algorithm = "native:extractbylocation",
|
|
|
- # INPUT = sprintf(
|
|
|
- # '%s table=\"%s\".\"%s\" (geom)',
|
|
|
- # postgres, andmed$schema[i], andmed$table[i]
|
|
|
- # ),
|
|
|
- # INTERSECT = sprintf("%s|layername=%s", dsn, intersect),
|
|
|
- # OUTPUT = output,
|
|
|
- # PREDICATE = c(0)
|
|
|
- # )
|
|
|
+ ## !!! Trikk: alguses leiame ühisosaga piirkonnad
|
|
|
result <- qgisprocess::qgis_run_algorithm(
|
|
|
- algorithm = "native:intersection",
|
|
|
+ algorithm = "native:extractbylocation",
|
|
|
INPUT = sprintf(
|
|
|
'%s table=\"%s\".\"%s\" (geom)',
|
|
|
postgres, andmed$schema[i], andmed$table[i]
|
|
|
),
|
|
|
+ INTERSECT = sprintf("%s|layername=%s", dsn, intersect),
|
|
|
+ # OUTPUT = output,
|
|
|
+ OUTPUT = tmp_gpkg_file,
|
|
|
+ PREDICATE = c(0)
|
|
|
+ )
|
|
|
+ ## !!! Trikk jätkub: edasi leiame alles ühisosa
|
|
|
+ result <- qgisprocess::qgis_run_algorithm(
|
|
|
+ algorithm = "native:intersection",
|
|
|
+ # INPUT = sprintf(
|
|
|
+ # '%s table=\"%s\".\"%s\" (geom)',
|
|
|
+ # postgres, andmed$schema[i], andmed$table[i]
|
|
|
+ # ),
|
|
|
+ INPUT = tmp_gpkg_file,
|
|
|
INPUT_FIELDS = "",
|
|
|
OVERLAY = sprintf("%s|layername=%s", dsn, intersect),
|
|
|
OVERLAY_FIELDS = "",
|