Skip to content

Commit 36a444f

Browse files
committed
#298 impl for description fields + test ISO 19115
1 parent e2c0fae commit 36a444f

File tree

3 files changed

+8
-13
lines changed

3 files changed

+8
-13
lines changed

R/geoflow_validator.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ geoflow_validator_cell <- R6Class("geoflow_validator_cell",
170170
}
171171
}
172172
}
173-
if("locale" %in% names(kvp)){
173+
if("locale" %in% names(kvp)) if(!is.null(kvp$locale)){
174174
if(nchar(kvp$locale)!= 2){
175175
report <- rbind(report, data.frame(type = "ERROR", message = sprintf("Locale value '%s' is invalid, it should be a locale ISO 2 code", kvp$locale)))
176176
}

inst/actions/geometa_create_iso_19115.R

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -238,9 +238,9 @@ function(action, entity, config){
238238

239239
#Data identification
240240
ident <- ISODataIdentification$new()
241-
ident$setAbstract(entity$descriptions[["abstract"]])
242-
ident$setPurpose(entity$descriptions[["purpose"]])
243-
ident$addCredit(entity$descriptions[["credit"]])
241+
ident$setAbstract(entity$descriptions[["abstract"]], locales = geoflow::get_locales_from(entity$descriptions[["abstract"]]))
242+
ident$setPurpose(entity$descriptions[["purpose"]], locales = geoflow::get_locales_from(entity$descriptions[["purpose"]]))
243+
ident$addCredit(entity$descriptions[["credit"]], locales = geoflow::get_locales_from(entity$descriptions[["credit"]]))
244244
ident$addStatus(entity$descriptions[["status"]])
245245
ident$addLanguage(entity$language)
246246
ident$addCharacterSet("utf8")
@@ -510,7 +510,7 @@ function(action, entity, config){
510510
ident$addKeywords(kwds)
511511
}
512512

513-
ident$setSupplementalInformation(entity$descriptions[["info"]])
513+
ident$setSupplementalInformation(entity$descriptions[["info"]], locales = geoflow::get_locales_from(entity$descriptions[["info"]]))
514514
if(!is.null(entity$data)) ident$addSpatialRepresentationType(entity$data$spatialRepresentationType)
515515
md$identificationInfo = c(md$identificationInfo,ident)
516516

inst/metadata/entity/entity_handler_df.R

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -125,14 +125,9 @@ handle_entities_df <- function(config, source){
125125
}
126126
descriptions <- if(!is.na(src_description)) extract_cell_components(src_description) else list()
127127
if(length(descriptions)>0){
128-
if(length(descriptions)==1){
129-
des_kvp <- extract_kvp(descriptions)
130-
entity$setDescription("abstract", paste(des_kvp$values, collapse=","))
131-
}else{
132-
for(description in descriptions){
133-
des_kvp <- extract_kvp(description)
134-
entity$setDescription(des_kvp$key, paste(des_kvp$values, collapse=","))
135-
}
128+
kvps <- extract_kvps(descriptions, collapse=",")
129+
for(kvp in kvps){
130+
entity$setDescription(kvp$key, kvp$values)
136131
}
137132
}
138133

0 commit comments

Comments
 (0)