|
|
@@ -96,6 +96,7 @@ gtfs <- function(conf = NULL) {
|
|
|
# dplyr::summarise() %>%
|
|
|
sf::st_cast("POINT")
|
|
|
sf::st_crs(sl) <- 4326
|
|
|
+ sl <- sf::st_transform(sl, 3301)
|
|
|
# # Test plot
|
|
|
# sl %>%
|
|
|
# ggplot2::ggplot(ggplot2::aes(colour = shape_id)) +
|
|
|
@@ -104,7 +105,7 @@ gtfs <- function(conf = NULL) {
|
|
|
# Write to database
|
|
|
tabeli_suffix <- "_source"
|
|
|
sf::st_write(
|
|
|
- obj = sl, dsn = conn, layer_options = c("GEOMETRY=AS_XY", "OVERWRITE=yes"),
|
|
|
+ obj = sl, dsn = conn, layer_options = c("OVERWRITE=yes"),
|
|
|
layer = sprintf("%s%s", conf$table, tabeli_suffix)
|
|
|
)
|
|
|
# Change schema
|
|
|
@@ -122,12 +123,12 @@ gtfs <- function(conf = NULL) {
|
|
|
# cat(qgis_show_help(algorithm = algorithm))
|
|
|
# Run algorithm.
|
|
|
output <- sprintf(
|
|
|
- 'postgres://dbname=\'%s\' host=%s port=%s user=\'%s\' sslmode=%s password=\'%s\' table=\"%s\".\"%s\" (geometry)',
|
|
|
+ '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)',
|
|
|
+ 'postgres://dbname=\'%s\' host=%s port=%s user=\'%s\' sslmode=%s password=\'%s\' srid=3301 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
|
|
|
)
|
|
|
@@ -138,7 +139,7 @@ gtfs <- function(conf = NULL) {
|
|
|
GROUP_FIELD = "shape_id",
|
|
|
INPUT = input,
|
|
|
ORDER_FIELD = "shape_pt_sequence",
|
|
|
- OUTPUT_TEXT_DIR = "/tmp/gtfs_output_text_dir/",
|
|
|
+ OUTPUT_TEXT_DIR = "/tmp/",
|
|
|
OUTPUT = output,
|
|
|
.quiet = TRUE
|
|
|
)
|
|
|
@@ -147,7 +148,7 @@ gtfs <- function(conf = NULL) {
|
|
|
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]
|
|
|
+ ), pg, conf$schema, "id", conf$table, tmp_dir, tbl_names[i]
|
|
|
)
|
|
|
cat(cmd)
|
|
|
cat("\n\n")
|