Skip to content

Commit

Permalink
fix #320
Browse files Browse the repository at this point in the history
  • Loading branch information
eblondel committed Apr 6, 2023
1 parent 5ac4ccc commit 96fb35b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
23 changes: 14 additions & 9 deletions R/geoflow_entity.R
Original file line number Diff line number Diff line change
Expand Up @@ -1217,6 +1217,11 @@ geoflow_entity <- R6Class("geoflow_entity",
layername <- if(!is.null(data_object$layername)) data_object$layername else self$identifiers$id
config$logger.info(sprintf("Enrich entity with OGC relations for layer = '%s'", layername))

geoserver_base_url = config$software$output$geoserver_config$parameters$url
if(!is.null(config$software$output$geoserver_config$properties$publicUrl)){
geoserver_base_url = config$software$output$geoserver_config$properties$publicUrl
}

#Thumbnail
if(geosapi_action$getOption("enrich_with_relation_wms_thumbnail")){
config$logger.info(sprintf("Enrich entity with OGC WMS thumbnail for layer = '%s'", layername))
Expand All @@ -1225,7 +1230,7 @@ geoflow_entity <- R6Class("geoflow_entity",
new_thumbnail$setName(layername)
new_thumbnail$setDescription(sprintf("%s - Map overview", layername))
new_thumbnail$setLink(sprintf("%s/%s/ows?service=WMS&version=1.1.0&request=GetMap&layers=%s&bbox=%s&width=600&height=300&srs=EPSG:%s&format=image/png",
config$software$output$geoserver_config$parameters$url,
geoserver_base_url,
config$software$output$geoserver_config$properties$workspace,
layername, paste(self$spatial_bbox,collapse=","),self$srid))
self$relations <- c(self$relations, new_thumbnail)
Expand All @@ -1240,7 +1245,7 @@ geoflow_entity <- R6Class("geoflow_entity",
new_wms$setName(layername)
new_wms$setDescription(sprintf("%s - Map access - OGC Web Map Service (WMS)",layername))
new_wms$setLink(sprintf("%s/%s/ows?service=WMS",
config$software$output$geoserver_config$parameters$url,
geoserver_base_url,
config$software$output$geoserver_config$properties$workspace))
self$addRelation(new_wms)
}else{
Expand All @@ -1257,7 +1262,7 @@ geoflow_entity <- R6Class("geoflow_entity",
new_wfs$setName(layername)
new_wfs$setDescription(sprintf("%s - Data (features) access - OGC Web Feature Service (WFS)", layername))
new_wfs$setLink(sprintf("%s/%s/ows?service=WFS",
config$software$output$geoserver_config$parameters$url,
geoserver_base_url,
config$software$output$geoserver_config$properties$workspace))
self$addRelation(new_wfs)
}else{
Expand All @@ -1272,7 +1277,7 @@ geoflow_entity <- R6Class("geoflow_entity",
new_wfs_gml$setName(layername)
new_wfs_gml$setDescription(sprintf("%s - Data download - OGC Web Feature Service (WFS) - GML format", layername))
new_wfs_gml$setLink(sprintf("%s/%s/ows?service=WFS&request=GetFeature&version=1.0.0&typeName=%s",
config$software$output$geoserver_config$parameters$url,
geoserver_base_url,
config$software$output$geoserver_config$properties$workspace,
layername))
new_wfs_gml$setMimeType("text/xml; subtype=gml/2.1.2")
Expand All @@ -1283,7 +1288,7 @@ geoflow_entity <- R6Class("geoflow_entity",
new_wfs_geojson$setName(layername)
new_wfs_geojson$setDescription(sprintf("%s - Data download - OGC Web Feature Service (WFS) - GeoJSON format", layername))
new_wfs_geojson$setLink(sprintf("%s/%s/ows?service=WFS&request=GetFeature&version=1.0.0&typeName=%s&outputFormat=json",
config$software$output$geoserver_config$parameters$url,
geoserver_base_url,
config$software$output$geoserver_config$properties$workspace,
layername))
new_wfs_geojson$setMimeType("application/json;charset=UTF-8")
Expand All @@ -1294,7 +1299,7 @@ geoflow_entity <- R6Class("geoflow_entity",
new_wfs_shp$setName(layername)
new_wfs_shp$setDescription(sprintf("%s - Data download - OGC Web Feature Service (WFS) - ESRI Shapefile format", layername))
new_wfs_shp$setLink(sprintf("%s/%s/ows?service=WFS&request=GetFeature&version=1.0.0&typeName=%s&outputFormat=SHAPE-ZIP",
config$software$output$geoserver_config$parameters$url,
geoserver_base_url,
config$software$output$geoserver_config$properties$workspace,
layername))
new_wfs_shp$setMimeType("application/zip")
Expand All @@ -1305,7 +1310,7 @@ geoflow_entity <- R6Class("geoflow_entity",
new_wfs_csv$setName(layername)
new_wfs_csv$setDescription(sprintf("%s - Data download - OGC Web Feature Service (WFS) - CSV format", layername))
new_wfs_csv$setLink(sprintf("%s/%s/ows?service=WFS&request=GetFeature&version=1.0.0&typeName=%s&outputFormat=CSV",
config$software$output$geoserver_config$parameters$url,
geoserver_base_url,
config$software$output$geoserver_config$properties$workspace,
layername))
new_wfs_csv$setMimeType("text/csv;charset=UTF-8")
Expand All @@ -1324,7 +1329,7 @@ geoflow_entity <- R6Class("geoflow_entity",
new_wcs$setName(layername)
new_wcs$setDescription(sprintf("%s - Data (Coverage) access - OGC Web Coverage Service (WCS)", layername))
new_wcs$setLink(sprintf("%s/%s/ows?service=WCS",
config$software$output$geoserver_config$parameters$url,
geoserver_base_url,
config$software$output$geoserver_config$properties$workspace))
self$addRelation(new_wcs)
}else{
Expand All @@ -1340,7 +1345,7 @@ geoflow_entity <- R6Class("geoflow_entity",
new_wcs_geotiff$setName(layername)
new_wcs_geotiff$setDescription(sprintf("%s - Data download - OGC Web Coverage Service (WCS) - GeoTIFF format", layername))
new_wcs_geotiff$setLink(sprintf("%s/%s/ows?service=WCS&request=GetCoverage&version=2.0.1&CoverageId=%s&format=image/geotiff",
config$software$output$geoserver_config$parameters$url,
geoserver_base_url,
config$software$output$geoserver_config$properties$workspace,
layername))
new_wcs_geotiff$setMimeType("image/tiff")
Expand Down
3 changes: 2 additions & 1 deletion R/geoflow_software.R
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,8 @@ register_software <- function(){
),
attributes = list(
workspace = list(label = "Workspace", def = "GeoServer workspace name", class = "character"),
store = list(label = "Store", def = "GeoServer data/coverage store name", class = "character")
store = list(label = "Store", def = "GeoServer data/coverage store name", class = "character"),
publicUrl = list(label = "Public URL", def = "Geoserver public URL", class = "character")
),
actions = list(
onstart = function(config, software, software_config){
Expand Down

0 comments on commit 96fb35b

Please sign in to comment.