Skip to content

Commit

Permalink
#28 manage topics (ISO 19139 topic categories) using entity subjects
Browse files Browse the repository at this point in the history
  • Loading branch information
eblondel committed Oct 21, 2019
1 parent 06b6916 commit ceb68e6
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions R/geoflow_action_geometa_create_iso_19115.R
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,14 @@ geometa_create_iso_19115 <- function(entity, config, options){
#TODO status (N)
ident$setLanguage(entity$language)
ident$setCharacterSet("utf8")
#TODO TopicCategory (N)
#topic categories
topics <- list()
if(length(entity$subjects)>0) topics <- entity$subjects[sapply(entity$subjects, function(x){return(tolower(x$name) == "topic")})]
if(length(topics)>0){
for(topic in topics){
for(topicCategory in topic$keywords) ident$addTopicCategory(topicCategory$name)
}
}

#adding contacts
for(entity_contact in entity$contacts){
Expand Down Expand Up @@ -288,7 +295,9 @@ geometa_create_iso_19115 <- function(entity, config, options){
ident$setExtent(extent)

#thesaurus/keywords
for(subject in entity$subjects){
subjects <- entity$subjects
if(length(subjects)>0) subjects <- subjects[sapply(subjects, function(x){return(x$name != "topic")})]
if(length(subjects)>0) for(subject in subjects){
#add keywords
kwds <- ISOKeywords$new()
for(kwd in subject$keywords){
Expand Down

0 comments on commit ceb68e6

Please sign in to comment.