Commit b9e04ddd authored by Sylvain Falala's avatar Sylvain Falala
Browse files

Manage mobility file

parent db965304
......@@ -20,6 +20,8 @@ vectorExt <- c("shp", "gpkg")
rasterExt <- c("tif", "tiff")
mobExt <- "csv"
acceptLayerType <- paste0(".", c(vectorExt, rasterExt))
reExt <- "\\.\\w{1,}$" # regular expression to define file extension
......@@ -114,9 +116,11 @@ lVect <- c("Vector","Vecteur")
lRast <- c("Raster","Raster")
lMob <- c("MobGraph","MobGraph")
langTitleFileInput <- c("Select layers",
"S&#233;lectionnez les fichiers de vecteurs et rasters")
"S&#233;lectionnez les fichiers de vecteurs - rasters - mobilite")
langButtonFileInput <- list(c("Browse...", "No file selected"),
c("Parcourir...", "Pas de selection"))
......
......@@ -62,6 +62,7 @@ server <- function(input, output, session) {
glUploadFileDF <<- rv$uploadFileDF
# Retrieve file extension to define type of layer: vector or raster
# or mobility file with csv extension
fileExt <- str_extract(layerFiles$name, reExt)
fileExt <- tolower(str_replace(fileExt, "\\.", ""))
......@@ -73,6 +74,9 @@ server <- function(input, output, session) {
indRast <- which(fileExt %in% rasterExt)
if(!is.na(indRast[1])) layerFiles[indRast,"layerType"] <- lRast[indLang]
indMob <- which(fileExt %in% mobExt)
if(!is.na(indMob[1])) layerFiles[indMob,"layerType"] <- lMob[indLang]
#Remove unknown file type
indRem <- which(layerFiles$layerType=="Unknown")
if(!is.na(indRem[1])) layerFiles <- layerFiles[-indRem,]
......@@ -95,7 +99,7 @@ server <- function(input, output, session) {
nbLayer <- nrow(layerFiles)
layerNames <- sort(layerFiles$shortName)
# Load vectors and rasters in global environment
# Load vectors, rasters and mobility file in global environment
for(k in 1:nbLayer){
#If vector
......@@ -134,6 +138,13 @@ server <- function(input, output, session) {
}
# If csv mobility file
if(layerFiles[k,"layerType"]==lMob[indLang]){
curLay <- read_network(layerFiles[k,"datapath"])
}
curLayerName <- paste("layer_", layerFiles[k,"shortName"], sep = "")
......@@ -475,7 +486,7 @@ server <- function(input, output, session) {
#invertScale <- FALSE
if(inherits(myLayer[[indStandLay]], c("Spatial", "RasterLayer")) && invertScale==FALSE) {
if(inherits(myLayer[[indStandLay]], c("Spatial", "RasterLayer", "igraph")) && invertScale==FALSE) {
standRaster <- myLayer[[indStandLay]]
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment