| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512 |
- ls <- list.files(path = tmp_dir, pattern = ".txt")
- ls_long <- list.files(path = tmp_dir, pattern = ".txt", full.names = T)
- tbl_names <- tools::file_path_sans_ext(list.files(path = tmp_dir, pattern = "*.txt"))
- # Export to postgis
- if (is.null(conf)) {
- conf <- ruut::get_config()
- conf$schema <- "xgtfs"
- conf$table <- ""
- }
- conf$table <- 'shapes'
- ruut::db_create_new_schema(conf = conf)
- # Postgresql string
- pg <- ruut::construct_ogr2ogr_PG_connect_str()
- # Connect to db
- conn <- ruut::db_connect()
- pg
- tbl_names
- i=8
- conf$table <- tbl_names[i]
- conf
- system(sprintf("mv %s %s/%s.csv", ls_long[i], tmp_dir, tbl_names[i]))
- shapes <- utils::read.csv(file = sprintf("%s/%s.csv", tmp_dir, tbl_names[i]))
- ## --------------- Points to SpatialLines -----------------
- cat("\n----------------\nMarsruutide geomeetria loomine\n")
- sl <- shapes %>%
- dplyr::arrange(shape_id, shape_pt_sequence) %>%
- sf::st_as_sf(coords = c("shape_pt_lon", "shape_pt_lat"), agr = "constant") %>%
- # dplyr::group_by(shape_id) %>%
- # dplyr::summarise() %>%
- sf::st_cast("POINT")
- sf::st_crs(sl) <- 4326
- sl <- shapes %>%
- dplyr::arrange(shape_id, shape_pt_sequence) %>%
- sf::st_as_sf(coords = c("shape_pt_lon", "shape_pt_lat"), agr = "constant") %>%
- # dplyr::group_by(shape_id) %>%
- # dplyr::summarise() %>%
- sf::st_cast("POINT")
- library(dplyr)
- sl <- shapes %>%
- dplyr::arrange(shape_id, shape_pt_sequence) %>%
- sf::st_as_sf(coords = c("shape_pt_lon", "shape_pt_lat"), agr = "constant") %>%
- # dplyr::group_by(shape_id) %>%
- # dplyr::summarise() %>%
- sf::st_cast("POINT")
- sf::st_crs(sl) <- 4326
- tabeli_suffix <- "_source"
- sf::st_write(
- obj = sl, dsn = conn, layer_options = c("GEOMETRY=AS_XY", "OVERWRITE=yes"),
- layer = sprintf("%s%s", conf$table, tabeli_suffix)
- )
- # Change schema
- q <- sprintf("
- drop table if exists %s.%s%s cascade; \
- ALTER TABLE %s%s SET SCHEMA %s", conf$schema, conf$table, tabeli_suffix, conf$table, tabeli_suffix, conf$schema)
- cat("\n----------------\nMuudame schema.\n")
- cat(q)
- DBI::dbExecute(conn, q)
- output <- sprintf(
- 'postgres://dbname=\'%s\' host=%s port=%s user=\'%s\' sslmode=%s password=\'%s\' table=\"%s\".\"%s\" (geom)',
- conf$dbname, conf$host, conf$port, conf$user, conf$sslmode, conf$password,
- conf$schema, conf$table
- )
- input <- sprintf(
- 'postgres://dbname=\'%s\' host=%s port=%s user=\'%s\' sslmode=%s password=\'%s\' srid=4326 type=Point checkPrimaryKeyUnicity=\'1\' table=\"%s\".\"%s_source\" (geometry)',
- conf$dbname, conf$host, conf$port, conf$user, conf$sslmode, conf$password,
- conf$schema, conf$table
- )
- result <- qgisprocess::qgis_run_algorithm(
- algorithm = algorithm,
- CLOSE_PATH = 0,
- DATE_FORMAT = "",
- GROUP_FIELD = "shape_id",
- INPUT = input,
- ORDER_FIELD = "shape_pt_sequence",
- OUTPUT = output,
- .quiet = TRUE
- )
- # qgis_algorithm_search_by_word(str = "pointstopath")
- algorithm <- "qgis:pointstopath"
- # cat(qgis_show_help(algorithm = algorithm))
- # Run algorithm.
- ## !!!!!!!!!!!!!!!!!!!! NB! pead muutma pythoni skripti 188 rida.
- ## File "/usr/share/qgis/python/plugins/processing/algs/qgis/PointsToPaths.py", line 188, in processAlgorithm
- ## Panin sinna mingi faili, sest temp faili ei osanud python kirjutada ja pärast lugeda.
- output <- sprintf(
- 'postgres://dbname=\'%s\' host=%s port=%s user=\'%s\' sslmode=%s password=\'%s\' table=\"%s\".\"%s\" (geom)',
- conf$dbname, conf$host, conf$port, conf$user, conf$sslmode, conf$password,
- conf$schema, conf$table
- )
- input <- sprintf(
- 'postgres://dbname=\'%s\' host=%s port=%s user=\'%s\' sslmode=%s password=\'%s\' srid=4326 type=Point checkPrimaryKeyUnicity=\'1\' table=\"%s\".\"%s_source\" (geometry)',
- conf$dbname, conf$host, conf$port, conf$user, conf$sslmode, conf$password,
- conf$schema, conf$table
- )
- result <- qgisprocess::qgis_run_algorithm(
- algorithm = algorithm,
- CLOSE_PATH = 0,
- DATE_FORMAT = "",
- GROUP_FIELD = "shape_id",
- INPUT = input,
- ORDER_FIELD = "shape_pt_sequence",
- OUTPUT = output,
- .quiet = TRUE
- )
- styler:::style_active_file()
- conf = NULL
- library(dplyr)
- # Temp directory
- tmp_dir <- "/tmp/gtfs"
- if (!dir.exists(tmp_dir)) {
- dir.create(tmp_dir)
- }
- # Download link
- url <- "http://www.peatus.ee/gtfs/"
- # Estonia shapefile (ZIP archive)
- map_shapefile <- "gtfs.zip"
- # Download and save
- url_download <- sprintf("%s%s", url, map_shapefile)
- saveTo <- sprintf("%s/%s", tmp_dir, map_shapefile)
- if (!file.exists(saveTo)) {
- utils::download.file(
- url = url_download,
- destfile = saveTo, method = "curl", extra = "-L"
- )
- }
- # Unzip
- utils::unzip(saveTo, overwrite = T, exdir = tmp_dir)
- # List of files
- ls <- list.files(path = tmp_dir, pattern = ".txt")
- ls_long <- list.files(path = tmp_dir, pattern = ".txt", full.names = T)
- tbl_names <- tools::file_path_sans_ext(list.files(path = tmp_dir, pattern = "*.txt"))
- # Export to postgis
- if (is.null(conf)) {
- conf <- ruut::get_config()
- conf$schema <- "gtfs"
- conf$table <- ""
- }
- # Multi layer: paneme kõik csv failid üheks failiks.
- if (file.exists(saveTo)) {
- ## Export to postgis database.
- # New schema
- ruut::db_create_new_schema(conf = conf)
- # Postgresql string
- pg <- ruut::construct_ogr2ogr_PG_connect_str()
- # Connect to db
- conn <- ruut::db_connect()
- # ---------- Copy CSV!!! data to database ----------
- for (i in 1:length(tbl_names)) {
- # Tabeli nimi
- conf$table <- tbl_names[i]
- # ogr2ogr oskab csv faili lugeda juhul kui laiend on csv. Muudame.
- system(sprintf("mv %s %s/%s.csv", ls_long[i], tmp_dir, tbl_names[i]))
- # Laeme eraldi andmed shape muutujasse, et teede geomeetriat leida
- if (tbl_names[i] == "shapes") {
- shapes <- utils::read.csv(file = sprintf("%s/%s.csv", tmp_dir, tbl_names[i]))
- ## --------------- Points to SpatialLines -----------------
- cat("\n----------------\nMarsruutide geomeetria loomine\n")
- sl <- shapes %>%
- dplyr::arrange(shape_id, shape_pt_sequence) %>%
- sf::st_as_sf(coords = c("shape_pt_lon", "shape_pt_lat"), agr = "constant") %>%
- # dplyr::group_by(shape_id) %>%
- # dplyr::summarise() %>%
- sf::st_cast("POINT")
- sf::st_crs(sl) <- 4326
- # # Test plot
- # sl %>%
- # ggplot2::ggplot(ggplot2::aes(colour = shape_id)) +
- # ggplot2::geom_sf()
- # plot(sl)
- # Write to database
- tabeli_suffix <- "_source"
- sf::st_write(
- obj = sl, dsn = conn, layer_options = c("GEOMETRY=AS_XY", "OVERWRITE=yes"),
- layer = sprintf("%s%s", conf$table, tabeli_suffix)
- )
- # Change schema
- q <- sprintf("
- drop table if exists %s.%s%s cascade; \
- ALTER TABLE %s%s SET SCHEMA %s", conf$schema, conf$table, tabeli_suffix, conf$table, tabeli_suffix, conf$schema)
- cat("\n----------------\nMuudame schema.\n")
- cat(q)
- DBI::dbExecute(conn, q)
- # ----------- Point to path teisendus ------------
- # Algoritmi juhend!
- # qgis_algorithm_search_by_word(str = "pointstopath")
- algorithm <- "qgis:pointstopath"
- # cat(qgis_show_help(algorithm = algorithm))
- # Run algorithm.
- ## !!!!!!!!!!!!!!!!!!!! NB! pead muutma pythoni skripti 188 rida.
- ## File "/usr/share/qgis/python/plugins/processing/algs/qgis/PointsToPaths.py", line 188, in processAlgorithm
- ## Panin sinna mingi faili, sest temp faili ei osanud python kirjutada ja pärast lugeda.
- output <- sprintf(
- 'postgres://dbname=\'%s\' host=%s port=%s user=\'%s\' sslmode=%s password=\'%s\' table=\"%s\".\"%s\" (geom)',
- conf$dbname, conf$host, conf$port, conf$user, conf$sslmode, conf$password,
- conf$schema, conf$table
- )
- input <- sprintf(
- 'postgres://dbname=\'%s\' host=%s port=%s user=\'%s\' sslmode=%s password=\'%s\' srid=4326 type=Point checkPrimaryKeyUnicity=\'1\' table=\"%s\".\"%s_source\" (geometry)',
- conf$dbname, conf$host, conf$port, conf$user, conf$sslmode, conf$password,
- conf$schema, conf$table
- )
- result <- qgisprocess::qgis_run_algorithm(
- algorithm = algorithm,
- CLOSE_PATH = 0,
- DATE_FORMAT = "",
- GROUP_FIELD = "shape_id",
- INPUT = input,
- ORDER_FIELD = "shape_pt_sequence",
- OUTPUT = output,
- .quiet = TRUE
- )
- } else {
- cmd <- sprintf(
- paste0(
- "ogr2ogr -f PostgreSQL ",
- "%s -lco SCHEMA=%s -lco OVERWRITE=yes -lco FID=%s -nln \"%s\" \"%s/%s.csv\""
- ), pg, conf$schema, "fid", conf$table, tmp_dir, tbl_names[i]
- )
- cat(cmd)
- cat("\n\n")
- system(cmd)
- }
- }
- # Lisame andmebaasi seosed
- q <- sprintf("
- ALTER TABLE %s.agency ADD CONSTRAINT agency_un UNIQUE (agency_id); \
- ALTER TABLE %s.calendar ADD CONSTRAINT calendar_un UNIQUE (service_id); \
- ALTER TABLE %s.fare_attributes ADD CONSTRAINT fare_attributes_un UNIQUE (fare_id); \
- ALTER TABLE %s.routes ADD CONSTRAINT routes_un UNIQUE (route_id); \
- ALTER TABLE %s.shapes ADD CONSTRAINT shapes_un UNIQUE (shape_id); \
- ALTER TABLE %s.stops ADD CONSTRAINT stops_un UNIQUE (stop_id); \
- ALTER TABLE %s.trips ADD CONSTRAINT trips_un UNIQUE (trip_id); \
- ALTER TABLE %s.fare_rules ADD CONSTRAINT fare_rules_fk FOREIGN KEY (fare_id) REFERENCES %s.fare_attributes(fare_id); \
- ALTER TABLE %s.fare_attributes ADD CONSTRAINT fare_attributes_fk FOREIGN KEY (agency_id) REFERENCES %s.agency(agency_id); \
- ALTER TABLE %s.routes ADD CONSTRAINT routes_fk FOREIGN KEY (agency_id) REFERENCES %s.agency(agency_id); \
- ALTER TABLE %s.calendar_dates ADD CONSTRAINT calendar_dates_fk FOREIGN KEY (service_id) REFERENCES %s.calendar(service_id); \
- ALTER TABLE %s.fare_rules ADD CONSTRAINT fare_rules_route_fk FOREIGN KEY (route_id) REFERENCES %s.routes(route_id); \
- ALTER TABLE %s.stop_times ADD CONSTRAINT stop_times_stops_fk FOREIGN KEY (stop_id) REFERENCES %s.stops(stop_id); \
- ALTER TABLE %s.stop_times ADD CONSTRAINT stop_times_trips_fk FOREIGN KEY (trip_id) REFERENCES %s.trips(trip_id); \
- ALTER TABLE %s.trips ADD CONSTRAINT trips_calendar_fk FOREIGN KEY (service_id) REFERENCES %s.calendar(service_id); \
- ALTER TABLE %s.trips ADD CONSTRAINT trips_routes_fk FOREIGN KEY (route_id) REFERENCES %s.routes(route_id);", conf$schema, conf$schema, conf$schema, conf$schema, conf$schema, conf$schema, conf$schema, conf$schema, conf$schema, conf$schema, conf$schema, conf$schema, conf$schema, conf$schema, conf$schema, conf$schema, conf$schema, conf$schema, conf$schema, conf$schema, conf$schema, conf$schema, conf$schema, conf$schema, conf$schema)
- cat(q)
- DBI::dbExecute(conn, q)
- # ogr2ogr help.
- # system("ogr2ogr --long-usage")
- # ogrinfo help.
- # system("ogrinfo --help-general")
- # pg <- ruut::construct_ogr2ogr_PG_connect_str()
- # system(sprintf("ogrinfo %s xgtfs.trips ", pg))
- # system(sprintf("ogrinfo %s xgtfs.trips ", pg))
- }
- # Delete temp directory
- # system(sprintf("rm -rf %s/*.csv", tmp_dir))
- }
- library(estmap)
- library(estmap)
- urls <- c("19-1.IBehaviorListener.2-=", "19-1.IBehaviorListener.2-")
- url_download <- "https://teeregister.mnt.ee/reet/shpreports?"
- url_download <- "https://teeregister.mnt.ee/reet/shpreports"
- urls <- c("19-1.IBehaviorListener.2-=", "19-1.IBehaviorListener.2-")
- i <- 1
- url <- sprintf("%s?%s", url_download, urls[i])
- cat(url)
- url_download <- "https://teeregister.mnt.ee/reet/shpreports"
- urls <- c("0-9.IBehaviorListener.0-RIIGITEE_SOIDUTEED", "19-1.IBehaviorListener.2-", "0-2.IBehaviorListener.2-")
- i <- 1
- url <- sprintf("%s?%s", url_download, urls[i])
- cat(url)
- url_download <- "https://teeregister.mnt.ee/reet/shpreports"
- urls <- c("0-5.IBehaviorListener.0-:idc", "19-1.IBehaviorListener.2-", "0-2.IBehaviorListener.2-")
- i <- 1
- url <- sprintf("%s?%s", url_download, urls[i])
- cat(url)
- system.file("inst/testimiseks/","test_1.R",package = "estmap")
- system.file("testimiseks/","test_1.R",package = "estmap")
- system.file("testimiseks","test_1.R",package = "estmap")
- library(estmap)
- tmp_dir <- system.file("tmp","gtfs",package = "estmap")
- tmp_dir
- system.file("tmp","gtfs",package = "estmap")
- tmp_dir <- system.file("tmp","Untitled Document.txt",package = "estmap")
- tmp_dir
- tmp_dir <- system.file("tmp/gtfs","Untitled Document.txt",package = "estmap")
- tmp_dir
- tmp_dir <- system.file("gtfs","Untitled Document.txt",package = "estmap")
- tmp_dir <- system.file("tmp","gtfs/Untitled Document.txt",package = "estmap")
- tmp_dir
- tmp_dir <- system.file("tmp","Untitled.txt",package = "estmap")
- tmp_dir
- tmp_dir <- system.file("undelited","undelited.txt",package = "estmap")
- tmp_dir
- tmp_dir <- system.file("undelited","undelited.txt",package = "estmap")
- tmp_dir
- system.file("undelited","test_1.R",package = "estmap")
- system.file("undelited","undelited.txt",package = "estmap")
- system.file("undelited","Undelited.txt",package = "estmap")
- system.file("undelited","Undelited.txt",package = "estmap")
- system.file("untitled","test_1.R",package = "estmap")
- system.file("untitled","test_1.R",package = "estmap")
- system.file("untitled","test_1.R",package = "estmap")
- system.file("untitled","test_1.R",package = "estmap")
- library(estmap)
- system.file("undelited","Undelited.txt",package = "estmap")
- system.file("untitled","Undelited.txt",package = "estmap")
- system.file("untitled","Untitled.txt",package = "estmap")
- system.file("tmp","Untitled.txt",package = "estmap")
- system.file("tmp/gtfs","Untitled.txt",package = "estmap")
- system.file("tmp/gtfs","Untitled.txt",package = "estmap")
- system.file("DESCRIPTION",package = "estmap")
- system.file("DESCRIPTION",package = "estmap")
- system.file(package = "estmap")
- tmp_dir <- sprintf("%s", system.file(package = "estmap"))
- tmp_dir
- tmp_dir <- sprintf("%s/tmp/%s", system.file(package = "estmap"), "gtfs")
- tmp_dir
- library(estmap)
- library(estmap)
- ans <- utils::askYesNo("Do you want to import gtfs data into database?")
- if (!ans | is.na(ans)) {
- cat("\n------------------------\n")
- cat("Kaardikihte ei lisatud.")
- cat("\n------------------------\n")
- return()
- }
- !ans | is.na(ans)
- ans <- utils::askYesNo("Do you want to import gtfs data into database?")
- ans
- !ans | is.na(ans)
- is.na(ans)
- ans <- utils::askYesNo("Do you want to import gtfs data into database?")
- ans <- utils::askYesNo("Do you want to import gtfs data into database?")
- ans
- is.na(ans)
- !ans | is.na(ans)
- ans
- ans <- NA
- ans
- ans <- NA
- ans <- utils::askYesNo("Do you want to import gtfs data into database?")
- cat("\n------------------------\n")
- cat("Kaardikihte ei lisatud.")
- cat("\n------------------------\n")
- return()
- }
- if (!ans | is.na(ans)) {
- cat("\n------------------------\n")
- cat("Kaardikihte ei lisatud.")
- cat("\n------------------------\n")
- return()
- }
- if (!ans | is.na(ans)) {
- cat("\n------------------------\n")
- cat("Kaardikihte ei lisatud.")
- cat("\n------------------------\n")
- # return()
- }
- ans <- NA
- ans <- utils::askYesNo("Do you want to import gtfs data into database?")
- cat("\n------------------------\n")
- cat("Kaardikihte ei lisatud.")
- cat("\n------------------------\n")
- # return()
- }
- ans <- NA
- ans <- utils::askYesNo("Do you want to import gtfs data into database?")
- ans
- ans <- NA
- ans <- utils::askYesNo("Do you want to import gtfs data into database?")
- ans <- utils::askYesNo("Do you want to import gtfs data into database?")
- ans
- ans <- utils::askYesNo("Do you want to import gtfs data into database?")
- ans
- ans <- utils::askYesNo("Do you want to import gtfs data into database?")
- ans
- ans <- utils::askYesNo("Do you want to import gtfs data into database?")
- ans
- ans <- utils::askYesNo("Do you want to import gtfs data into database?")
- ans
- ans <- utils::askYesNo("Do you want to import gtfs data into database?")
- ans
- ans <- utils::askYesNo("Do you want to import gtfs data into database?")
- ans <- utils::askYesNo("Do you want to import gtfs data into database?", default = F)
- ans
- ans <- utils::askYesNo("Do you want to import gtfs data into database?", default = F)
- ans
- styler:::style_active_file()
- styler:::style_active_file()
- library(estmap)
- library(estmap)
- library(estmap)
- conf = NULL
- # Temp directory
- tmp_dir <- sprintf("%s/tmp/%s", system.file(package = "estmap"), "osm_shp")
- if (!dir.exists(tmp_dir)) {
- dir.create(tmp_dir)
- }
- # Download link
- url <- "https://download.geofabrik.de/europe"
- # Estonia shapefile (ZIP archive)
- map_shapefile <- "estonia-latest-free.shp.zip"
- # Download and save
- url_download <- sprintf("%s/%s", url, map_shapefile)
- saveTo <- sprintf("%s/%s", tmp_dir, map_shapefile)
- if (!file.exists(saveTo)) {
- utils::download.file(
- url = url_download,
- destfile = saveTo, method = "curl", extra = "-L"
- )
- }
- # Unzip
- utils::unzip(saveTo, overwrite = T, exdir = tmp_dir)
- # List of files
- ls <- list.files(path = tmp_dir, pattern = ".dbf")
- ls_long <- list.files(path = tmp_dir, pattern = ".dbf", full.names = T)
- tbl_names <- unlist(strsplit(x = ls, split = ".dbf"))
- # Export to postgis
- if (is.null(conf)) {
- conf <- ruut::get_config()
- conf$schema <- "osm_shp"
- }
- # New schema
- ruut::db_create_new_schema(conf = conf)
- tbl_names
- conf = NULL
- # Temp directory
- tmp_dir <- sprintf("%s/tmp/%s", system.file(package = "estmap"), "osm_shp")
- if (!dir.exists(tmp_dir)) {
- dir.create(tmp_dir)
- }
- # Download link
- url <- "https://download.geofabrik.de/europe"
- # Estonia shapefile (ZIP archive)
- map_shapefile <- "estonia-latest-free.shp.zip"
- # Download and save
- url_download <- sprintf("%s/%s", url, map_shapefile)
- saveTo <- sprintf("%s/%s", tmp_dir, map_shapefile)
- file.exists(saveTo)
- if (!file.exists(saveTo)) {
- utils::download.file(
- url = url_download,
- destfile = saveTo, method = "curl", extra = "-L"
- )
- }
- # Unzip
- utils::unzip(saveTo, overwrite = T, exdir = tmp_dir)
- # List of files
- ls <- list.files(path = tmp_dir, pattern = ".dbf")
- ls_long <- list.files(path = tmp_dir, pattern = ".dbf", full.names = T)
- tbl_names <- unlist(strsplit(x = ls, split = ".dbf"))
- # Export to postgis
- if (is.null(conf)) {
- conf <- ruut::get_config()
- conf$schema <- "osm_shp"
- }
- # New schema
- ruut::db_create_new_schema(conf = conf)
- map_shapefile
- # Multi layer
- for (i in 1:length(tbl_names)) {
- print(tbl_names[i])
- conf$table <- gsub("gis_osm_", "", gsub("_free_1", "", tbl_names[i]))
- source <- sprintf('"%s" "%s"', tmp_dir, tbl_names[i])
- ## Export to postgis database.
- ruut::copy_shp_to_db(
- dir = tmp_dir, layer = tbl_names[i], conf = conf,
- id = "fid", crs_source = "EPSG:4326", crs_target = "EPSG:4326",
- geometry_type = "PROMOTE_TO_MULTI"
- )
- cat(sprintf(
- "\nShp fail %s kopeeriti POSTGIS andmebaasi %s.%s\n\n",
- ls[i], conf$schema, conf$table
- ))
- }
- # Delete unnecessary files.
- system(sprintf("find %s -type f -not -name '%s' -print0 | xargs -0 rm --", tmp_dir, map_shapefile))
- styler:::style_active_file()
- styler:::style_active_file()
- library(estmap)
- conf = NULL
- # Export to postgis
- if (is.null(conf)) {
- conf <- ruut::get_config()
- conf$schema <- "teeregister_wfs"
- }
- ruut::db_create_new_schema(conf = conf)
- ## Teeregistri avaandmete kihtide lugemine
- wfs_list <- loe_teeregistri_wfs_kihid()
- layer_list <- wfs_list[, "layer"]
- wfs_list <- loe_teeregistri_wfs_kihid()
- wfs_list <- estmap:::loe_teeregistri_wfs_kihid()
- wfs_list
- layer_list
- layer_list <- wfs_list[, "layer"]
- layer_list
- installed_tables <- ruut::db_schema_tablenames(conf = conf)
- installed_tables
- layer_list
- i=1
- wfs_layer <- layer_list[i]
- conf$table <- gsub("ms:", "", wfs_layer)
- conf$table
- conf$table <- tolower(gsub("ms:", "", wfs_layer))
- conf$table
- conf$table %in% installed_tables
- !conf$table %in% installed_tables
- styler:::style_active_file()
- i=58
- wfs_layer <- layer_list[i]
- conf$table <- tolower(gsub("ms:", "", wfs_layer))
- !conf$table %in% installed_tables
- library(estmap)
- teeregister_wfs()
|