@@ -1637,6 +1637,11 @@ geoflow_entity <- R6Class("geoflow_entity",
16371637 # '@param config geoflow config object
16381638 enrichWithRelations = function (config ){
16391639
1640+ # check for geoflow auto-set relations, if any we remove them to avoid duplicating auto-set relations
1641+ if (any(sapply(self $ relations , function (x ){x $ prov == " geoflow" }))){
1642+ self $ relations = self $ relations [sapply(self $ relations , function (x ){x $ prov != " geoflow" })]
1643+ }
1644+
16401645 geosapi_action <- NULL
16411646 actions <- list ()
16421647 if (length(config $ actions )> 0 ) actions <- config $ actions [sapply(config $ actions , function (x ){regexpr(" geosapi" ,x $ id )> 0 })]
@@ -1667,6 +1672,7 @@ geoflow_entity <- R6Class("geoflow_entity",
16671672 if (geosapi_action $ getOption(" enrich_with_relation_wms_thumbnail" )){
16681673 config $ logger $ INFO(" Enrich entity with OGC WMS thumbnail for layer = '%s'" , layername )
16691674 new_thumbnail <- geoflow_relation $ new()
1675+ new_thumbnail $ setProv(" geoflow" )
16701676 new_thumbnail $ setKey(" thumbnail" )
16711677 new_thumbnail $ setName(layername )
16721678 map_overview = set_i18n(term_key = " graphic_overview" , expr = " {{layername}} - {{term}}" , layername = layername )
@@ -1693,6 +1699,7 @@ geoflow_entity <- R6Class("geoflow_entity",
16931699 if (geosapi_action $ getOption(" enrich_with_relation_wms" )){
16941700 config $ logger $ INFO(" Enrich entity with OGC WMS base URL for layer = '%s'" , layername )
16951701 new_wms <- geoflow_relation $ new()
1702+ new_wms $ setProv(" geoflow" )
16961703 new_wms $ setKey(" wms" )
16971704 new_wms $ setName(layername )
16981705 new_wms $ setDescription(
@@ -1717,6 +1724,7 @@ geoflow_entity <- R6Class("geoflow_entity",
17171724 if (geosapi_action $ getOption(" enrich_with_relation_wfs" )){
17181725 config $ logger $ INFO(" Enrich entity with OGC WFS base URL for layer = '%s'" , layername )
17191726 new_wfs <- geoflow_relation $ new()
1727+ new_wfs $ setProv(" geoflow" )
17201728 new_wfs $ setKey(" wfs" )
17211729 new_wfs $ setName(layername )
17221730 new_wfs $ setDescription(
@@ -1739,6 +1747,7 @@ geoflow_entity <- R6Class("geoflow_entity",
17391747 config $ logger $ INFO(" Enrich entity with OGC WFS download links for layer = '%s'" , layername )
17401748 # wfs (GML)
17411749 new_wfs_gml <- geoflow_relation $ new()
1750+ new_wfs_gml $ setProv(" geoflow" )
17421751 new_wfs_gml $ setKey(" download" )
17431752 new_wfs_gml $ setName(layername )
17441753 new_wfs_gml $ setDescription(
@@ -1757,6 +1766,7 @@ geoflow_entity <- R6Class("geoflow_entity",
17571766 self $ addRelation(new_wfs_gml )
17581767 # wfs (GeoJSON)
17591768 new_wfs_geojson <- geoflow_relation $ new()
1769+ new_wfs_geojson $ setProv(" geoflow" )
17601770 new_wfs_geojson $ setKey(" download" )
17611771 new_wfs_geojson $ setName(layername )
17621772 new_wfs_geojson $ setDescription(
@@ -1775,6 +1785,7 @@ geoflow_entity <- R6Class("geoflow_entity",
17751785 self $ addRelation(new_wfs_geojson )
17761786 # wfs (ESRI Shapefile)
17771787 new_wfs_shp <- geoflow_relation $ new()
1788+ new_wfs_shp $ setProv(" geoflow" )
17781789 new_wfs_shp $ setKey(" download" )
17791790 new_wfs_shp $ setName(layername )
17801791 new_wfs_shp $ setDescription(
@@ -1793,6 +1804,7 @@ geoflow_entity <- R6Class("geoflow_entity",
17931804 self $ addRelation(new_wfs_shp )
17941805 # CSV
17951806 new_wfs_csv <- geoflow_relation $ new()
1807+ new_wfs_csv $ setProv(" geoflow" )
17961808 new_wfs_csv $ setKey(" download" )
17971809 new_wfs_csv $ setName(layername )
17981810 new_wfs_csv $ setDescription(
@@ -1819,6 +1831,7 @@ geoflow_entity <- R6Class("geoflow_entity",
18191831 if (geosapi_action $ getOption(" enrich_with_relation_wcs" )){
18201832 config $ logger $ INFO(" Enrich entity with OGC WCS base URL for layer = '%s'" , layername )
18211833 new_wcs <- geoflow_relation $ new()
1834+ new_wcs $ setProv(" geoflow" )
18221835 new_wcs $ setKey(" wcs" )
18231836 new_wcs $ setName(layername )
18241837 new_wcs $ setDescription(
@@ -1842,6 +1855,7 @@ geoflow_entity <- R6Class("geoflow_entity",
18421855 config $ logger $ INFO(" Enrich entity with OGC WCS download links for layer = '%s'" , layername )
18431856 # wcs (image/geotiff)
18441857 new_wcs_geotiff <- geoflow_relation $ new()
1858+ new_wcs_geotiff $ setProv(" geoflow" )
18451859 new_wcs_geotiff $ setKey(" download" )
18461860 new_wcs_geotiff $ setName(layername )
18471861 new_wcs_geotiff $ setDescription(
@@ -1883,6 +1897,7 @@ geoflow_entity <- R6Class("geoflow_entity",
18831897 geonetwork_base_url = config $ software $ output $ geonetwork_config $ parameters $ url
18841898 # xml metadata url
18851899 metadata_url <- geoflow_relation $ new()
1900+ metadata_url $ setProv(" geoflow" )
18861901 metadata_url $ setKey(" http" )
18871902 metadata_url $ setName(" ISO 19115 metadata (CSW GetRecordById)" )
18881903 csw_record_url = paste0(
@@ -1896,6 +1911,7 @@ geoflow_entity <- R6Class("geoflow_entity",
18961911
18971912 # html metadata url
18981913 metadata_url_2 = geoflow_relation $ new()
1914+ metadata_url_2 $ setProv(" geoflow" )
18991915 metadata_url_2 $ setKey(" http" )
19001916 metadata_url_2 $ setName(" ISO 19115 metadata (HTML)" )
19011917 html_record_url = paste0(geonetwork_base_url , " /srv/api/records/" , mdId )
@@ -1911,6 +1927,7 @@ geoflow_entity <- R6Class("geoflow_entity",
19111927 csw_base_url = config $ software $ output $ csw_config $ parameters $ url
19121928 # xml metadata url
19131929 metadata_url <- geoflow_relation $ new()
1930+ metadata_url $ setProv(" geoflow" )
19141931 metadata_url $ setKey(" http" )
19151932 metadata_url $ setName(" ISO 19115 metadata (CSW GetRecordById)" )
19161933 csw_record_url = paste0(
@@ -1927,6 +1944,7 @@ geoflow_entity <- R6Class("geoflow_entity",
19271944 if (regexpr(" geonetwork" , csw_base_url )> 0 ){
19281945 geonetwork_base_url = unlist(strsplit(csw_base_url , " /srv" ))[1 ]
19291946 metadata_url_2 = geoflow_relation $ new()
1947+ metadata_url_2 $ setProv(" geoflow" )
19301948 metadata_url_2 $ setKey(" http" )
19311949 metadata_url_2 $ setName(" ISO 19115 metadata (HTML)" )
19321950 html_record_url = paste0(geonetwork_base_url , " /srv/api/records/" , mdId )
0 commit comments