Skip to content

Commit

Permalink
introduce sourceType = 'zip' in case of zip files that we want to hav…
Browse files Browse the repository at this point in the history
…e scanned by geoflow
  • Loading branch information
eblondel committed Sep 6, 2023
1 parent 776c1fb commit 8148d0d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
8 changes: 4 additions & 4 deletions R/geoflow_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
#'
geoflow_data <- R6Class("geoflow_data",
private = list(
supportedSourceTypes = c("dbtable", "dbview", "dbquery","shp", "csv", "gpkg", "other","nc", "geotiff"),
supportedUploadTypes = c("dbtable", "dbview", "dbquery","shp", "gpkg", "other","nc", "geotiff"),
supportedSourceTypes = c("dbtable", "dbview", "dbquery", "zip", "shp", "csv", "gpkg", "other","nc", "geotiff"),
supportedUploadTypes = c("dbtable", "dbview", "dbquery", "shp", "gpkg", "other","nc", "geotiff"),
supportedGeomPossibleNames = c("the_geom", "geom", "wkt", "geom_wkt", "wkb", "geom_wkb"),
supportedXPossibleNames = c("x","lon","long","longitude","decimalLongitude"),
supportedYPossibleNames = c("y","lat","lati","latitude","decimalLatitude"),
Expand Down Expand Up @@ -497,8 +497,8 @@ geoflow_data <- R6Class("geoflow_data",
ext_data$setSourceType(sourceType)
}
if((is.null(self$uploadType) || self$uploadType == "other") && !is.null(sourceType)){
ext_data$setUploadType(sourceType)
if(ext_data$uploadType == "geotiff") ext_data$setSpatialRepresentationType("grid")
if(sourceType != "zip") ext_data$setUploadType(sourceType)
if(!is.null(ext_data$uploadType)) if(ext_data$uploadType == "geotiff") ext_data$setSpatialRepresentationType("grid")
}

hasStoreDeclared <- FALSE
Expand Down
8 changes: 7 additions & 1 deletion R/geoflow_entity.R
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,10 @@ geoflow_entity <- R6Class("geoflow_entity",
"zip" = {
srcType = "other"
basefilepath = file.path(getwd(), paste0(basefilename,".zip"))
if(file.exists(basefilepath)){ #for srcType != "other"
if(file.exists(basefilepath)){
#for srcType != "other"
#(re-zipped files on 'basefinename' with 'other' sourceType do not exist,
#but are just copied, not unzipped/rezipped with different name)
zip_files = zip::zip_list(basefilepath)
if(any(endsWith(zip_files$filename, ".gpkg"))){
srcType = "gpkg"
Expand All @@ -668,14 +671,17 @@ geoflow_entity <- R6Class("geoflow_entity",
#additional rule for uploadType
if(datasource_ext == "zip") if(!is.null(data_object$uploadType)) if(data_object$uploadType == "other"){
data_object$uploadType = data_object$sourceType
if(data_object$uploadType == "geotiff") data_object$setSpatialRepresentationType("grid")
}
#overwrite top sourceType
if(is.null(self$data$dir)){
self$data$sourceType = data_object$sourceType
self$data$uploadType = data_object$uploadType
self$data$setSpatialRepresentationType(data_object$spatialRepresentationType)
}else{
self$data$data[[k]]$sourceType = data_object$sourceType
self$data$data[[k]]$uploadType = data_object$uploadType
self$data$data[[k]]$setSpatialRepresentationType(data_object$spatialRepresentationType)
}
}

Expand Down

0 comments on commit 8148d0d

Please sign in to comment.