Skip to content
Snippets Groups Projects
Commit 4243cab4 authored by Juliette Engelaere-Lefebvre's avatar Juliette Engelaere-Lefebvre
Browse files

bux fix nom champ geo conforme à l'original avec importer_data()

parent a5ade9b7
No related branches found
No related tags found
No related merge requests found
Pipeline #58808 passed
Package: datalibaba
Title: Interface De Connexion a Une Base Posgres Postgis
Version: 0.0.0.9001
Version: 0.0.0.9002
Authors@R:
c(person(given = "Maël",
family = "Theulière",
......
# datalibaba 0.0.0.9002
- Correction d'un bug dans la fonction `importer_data()` : nommage du champ geo tel qu'il avait été chargé
# datalibaba 0.0.0.9001
- Correction d'un bug dans la fonction `poster_data()` : paramétrage des contraintes géo selon le nom de la colonne géo. (auparavant utilisation de 'geometry' pour toutes les tables, ce qui provoquait des plantages).
- Ajout de message pour le post de datatset geo afin d'identifier quelle étape est en cours.
- Ajout de message pour le post de dataset geo afin d'identifier quelle étape est en cours.
# datalibaba 0.0.0.9000
......
......@@ -172,6 +172,10 @@ importer_data <- function(table = NULL, schema = NULL, db = "public", server =
# remettre le champ geometrie (au bon endroit)
if(exists("data_sf") & nrow(def_table) > 0) {
sf::st_geometry(data) <- sf::st_geometry(data_sf)
# renommage du champ geo a l'identique
data <- dplyr::rename_with(data, ~gsub("^geometry$", sf_col_name, .x))
sf::st_geometry(data) <- attributes(data_sf)$sf_column
data <- dplyr::relocate(data, dplyr::all_of(defs$nms))
}
......
......@@ -244,12 +244,11 @@ poster_data <- function(data = NULL,
# }
# Ajout index geo
nom_champ_geo <-
rpostgis::dbIndex(conn = con, name = c(schema, table), colname = attributes(d)$sf_column,
idxname = paste0("gix_", table), unique = FALSE, method = "gist",
display = FALSE, exec = TRUE)
index_spatial <- rpostgis::dbIndex(conn = con, name = c(schema, table), colname = nom_col_geo,
idxname = paste0("gix_", table), unique = FALSE, method = "gist",
display = FALSE, exec = TRUE)
mess <- "spatial "
mess2 <- paste0(" - index spatial declar\u00e9 sur '", attributes(d)$sf_column, "'")
mess2 <- ifelse(index_spatial, paste0(" - index spatial declar\u00e9 sur '", nom_col_geo, "'"), "")
} else {
DBI::dbWriteTable(con, name = c(schema, table), d, row.names = FALSE, overwrite = overwrite)
mess <- ""
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment