adiwg-mdtranslator 1.1.1 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/adiwg-mdtranslator.gemspec +3 -1
- data/bin/mdtranslator +5 -5
- data/lib/adiwg/mdtranslator.rb +8 -29
- data/lib/adiwg/mdtranslator/internal/internal_metadata_obj.rb +2 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/mdJson_reader.rb +21 -2
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_1.0/module_contacts.rb +5 -3
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_1.0/module_mdJson.rb +4 -11
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_1.0/module_metadataInfo.rb +9 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_1.0/module_resourceInfo.rb +9 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_1.0/module_responsibleParty.rb +12 -0
- data/lib/adiwg/mdtranslator/version.rb +6 -1
- data/lib/adiwg/mdtranslator/writers/html/sections/html_body.rb +7 -4
- data/lib/adiwg/mdtranslator/writers/html/sections/html_bodyScript.js +21 -3
- data/lib/adiwg/mdtranslator/writers/html/sections/html_geographicElement.rb +2 -1
- data/lib/adiwg/mdtranslator/writers/html/sections/html_inlineCss.css +16 -3
- data/lib/adiwg/mdtranslator/writers/html/sections/html_metadataInfo.rb +9 -0
- data/lib/adiwg/mdtranslator/writers/html/sections/html_resourceGeneral.rb +17 -1
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_aggregateInformation.rb +5 -6
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_citation.rb +5 -4
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_codelist.rb +51 -0
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_dataIdentification.rb +23 -11
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_dataQuality.rb +4 -3
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_date.rb +4 -3
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_enumerationList.rb +47 -0
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_keyword.rb +4 -3
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_legalConstraints.rb +5 -4
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_maintenanceInformation.rb +5 -4
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_medium.rb +5 -6
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_metadataExtension.rb +7 -6
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_onlineResource.rb +4 -3
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_responsibleParty.rb +4 -3
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_securityConstraints.rb +4 -3
- data/lib/adiwg/mdtranslator/writers/iso19110/class_FCfeatureCatalogue.rb +5 -1
- data/lib/adiwg/mdtranslator/writers/iso19115_2/class_MImetadata.rb +17 -10
- data/lib/adiwg/mdtranslator/writers/iso19115_2/iso19115_2_writer.rb +1 -1
- metadata +19 -24
- data/lib/adiwg/mdtranslator/writers/iso/codelists/code_associationType.rb +0 -47
- data/lib/adiwg/mdtranslator/writers/iso/codelists/code_characterSet.rb +0 -93
- data/lib/adiwg/mdtranslator/writers/iso/codelists/code_classification.rb +0 -53
- data/lib/adiwg/mdtranslator/writers/iso/codelists/code_datatype.rb +0 -67
- data/lib/adiwg/mdtranslator/writers/iso/codelists/code_dateType.rb +0 -44
- data/lib/adiwg/mdtranslator/writers/iso/codelists/code_initiativeType.rb +0 -47
- data/lib/adiwg/mdtranslator/writers/iso/codelists/code_keywordType.rb +0 -52
- data/lib/adiwg/mdtranslator/writers/iso/codelists/code_maintenanceFrequency.rb +0 -61
- data/lib/adiwg/mdtranslator/writers/iso/codelists/code_mediumFormat.rb +0 -50
- data/lib/adiwg/mdtranslator/writers/iso/codelists/code_mediumName.rb +0 -74
- data/lib/adiwg/mdtranslator/writers/iso/codelists/code_obligation.rb +0 -39
- data/lib/adiwg/mdtranslator/writers/iso/codelists/code_onlineFunction.rb +0 -48
- data/lib/adiwg/mdtranslator/writers/iso/codelists/code_presentationForm.rb +0 -71
- data/lib/adiwg/mdtranslator/writers/iso/codelists/code_progress.rb +0 -52
- data/lib/adiwg/mdtranslator/writers/iso/codelists/code_restriction.rb +0 -53
- data/lib/adiwg/mdtranslator/writers/iso/codelists/code_role.rb +0 -60
- data/lib/adiwg/mdtranslator/writers/iso/codelists/code_scope.rb +0 -69
- data/lib/adiwg/mdtranslator/writers/iso/codelists/code_spatialRepresentationType.rb +0 -49
- data/lib/adiwg/mdtranslator/writers/iso/codelists/code_topicCategory.rb +0 -57
- data/test/readers/mdJson/v1_0/tc_reader_mdjson_responsibleParty.rb +0 -76
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 874e4c69c1bbc8d2aaf5a6754802325a65526750
|
4
|
+
data.tar.gz: e205f480b6a18acc9b0575449cb783d01397c1a7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d6cfe28c5a9154da568b2e60560c72a4ae7090732570c74e5b65227f22b83d03eb777588064bb7b124dd5afeea03b5a41613174ead01811a5ec8c31809418a45
|
7
|
+
data.tar.gz: 2523859c1310086ef1a58ae9dd33288e0c38f875145617d4f13db5e4fdfc9626959869685f8b34be3c78dbec619529dc8d13d75e77bf8d383600cb907eed9532
|
data/adiwg-mdtranslator.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.authors = ["Stan Smith", "Josh Bradley"]
|
11
11
|
spec.email = ["stansmith@usgs.gov", "joshua_bradley@fws.gov"]
|
12
12
|
spec.summary = %q{The mdtranslator (metadata translator) is a tool for translating metadata in one format to another. The tool is written and maintained by the Alaska Data Integration Working Group (ADIwg).}
|
13
|
-
spec.description = %q{The mdtranslator was written by the Alaska Data Integration Working Group (ADIwg) to assist with creating ISO 19139 metadata records. Input to the mdtranslator is
|
13
|
+
spec.description = %q{The mdtranslator was written by the Alaska Data Integration Working Group (ADIwg) to assist with creating ISO 19139 metadata records. Input to the mdtranslator is JSON conforming to the mdJson-schema. The mdtranslator architecture allows developers to write additional readers for other input formats and/or write additional writers for other output other than ISO 19139.}
|
14
14
|
spec.homepage = "http://www.adiwg.org/mdTranslator"
|
15
15
|
spec.license = "UNLICENSED"
|
16
16
|
|
@@ -31,4 +31,6 @@ Gem::Specification.new do |spec|
|
|
31
31
|
spec.add_runtime_dependency "uuidtools", "~> 2.1"
|
32
32
|
spec.add_runtime_dependency "json-schema", "~> 2.4.0", "< 2.5.0"
|
33
33
|
spec.add_runtime_dependency "adiwg-mdjson_schemas", "~> 1.0.0"
|
34
|
+
spec.add_runtime_dependency "adiwg-mdcodes", "~> 1.0"
|
35
|
+
|
34
36
|
end
|
data/bin/mdtranslator
CHANGED
@@ -23,13 +23,13 @@ class Mdtranslator < Thor
|
|
23
23
|
# basic cli description
|
24
24
|
desc 'translate [FILE]', %q{Pass JSON string or filename plus parameters to mdtranslator translate}
|
25
25
|
long_desc <<-LONGDESC
|
26
|
-
|
27
|
-
|
28
|
-
|
26
|
+
'mdtranslator translate' provides command line access to the ADIWG metadata translator
|
27
|
+
with options to select the input file reader, select writer output format, show empty tags
|
28
|
+
in XML outputs, and choose level of validation for JSON inputs.
|
29
29
|
LONGDESC
|
30
30
|
# define cli options
|
31
|
-
method_option :reader, :aliases => '-r', :desc => '
|
32
|
-
method_option :writer, :aliases => '-w', :desc => '
|
31
|
+
method_option :reader, :aliases => '-r', :desc => 'Reader to read your input metadata file', :enum => %w{mdJson}, :required => true
|
32
|
+
method_option :writer, :aliases => '-w', :desc => 'Writer to create your output metadata file, leave blank to validate input only', :enum => %w{iso19115_2 iso19110 html}
|
33
33
|
method_option :validate, :aliases => '-v', :desc => 'Specify level of validation to be performed', :enum => %w{none normal strict}, :default => 'normal'
|
34
34
|
method_option :showAllTags, :aliases => '-s', :desc => 'Include tags for unused attributes', :type => :boolean, :default => false
|
35
35
|
method_option :messages, :aliases => '-m', :desc => 'On error return messages as formatted text or json object', :enum => %w{json text}, :default => 'text'
|
data/lib/adiwg/mdtranslator.rb
CHANGED
@@ -33,24 +33,6 @@ require 'adiwg/mdtranslator/writers/mdWriters'
|
|
33
33
|
module ADIWG
|
34
34
|
module Mdtranslator
|
35
35
|
|
36
|
-
def self.addFinalMessages
|
37
|
-
if $response[:readerStructurePass].nil?
|
38
|
-
$response[:readerStructureMessages].insert(0, 'Input file structure was not checked \n')
|
39
|
-
end
|
40
|
-
|
41
|
-
if $response[:readerValidationPass].nil?
|
42
|
-
$response[:readerValidationMessages].insert(0, 'Validator was not called \n')
|
43
|
-
end
|
44
|
-
|
45
|
-
if $response[:readerExecutionPass].nil?
|
46
|
-
$response[:readerExecutionMessages].insert(0, 'Reader was not called \n')
|
47
|
-
end
|
48
|
-
|
49
|
-
if $response[:writerPass].nil?
|
50
|
-
$response[:writerMessages].insert(0, 'Writer not called \n')
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
36
|
def self.translate(file:, reader:, validate: 'normal', writer: nil, showAllTags: false)
|
55
37
|
|
56
38
|
$showAllTags = showAllTags
|
@@ -80,7 +62,7 @@ module ADIWG
|
|
80
62
|
# is 'false', set one or more messages to assist user fixing file schema validation
|
81
63
|
# problems. Set by reader.
|
82
64
|
# readerExecutionPass: 'true' if the reader completes the import of the input file into
|
83
|
-
# the internal object without errors set by reader
|
65
|
+
# the internal object without errors. set by reader.
|
84
66
|
# readerExecutionMessages: an array of quoted string messages. If readerExecutionPass is
|
85
67
|
# 'false', set one or more messages to assist user in fixing file data problems.
|
86
68
|
# Set by reader.
|
@@ -88,7 +70,7 @@ module ADIWG
|
|
88
70
|
# list. if nil no write was requested and only validation of the input file will
|
89
71
|
# be performed.
|
90
72
|
# writerVersion: current version of the writer requested, set by writer
|
91
|
-
# writerFormat: format of the output from the writer
|
73
|
+
# writerFormat: format of the output from the writer. Set by writer.
|
92
74
|
# writerPass: true if the writer completes the creation of the output file without errors,
|
93
75
|
# set by writer
|
94
76
|
# writerMessages: an array of quoted string messages. If writerPass is 'false', set one
|
@@ -118,20 +100,18 @@ module ADIWG
|
|
118
100
|
|
119
101
|
# handle readers
|
120
102
|
if reader.nil? || reader == ''
|
121
|
-
$response[:
|
122
|
-
$response[:
|
123
|
-
$response[:readerExecutionMessages] << 'Reader name is missing.'
|
124
|
-
$response[:writerMessages] << 'Input file was not read.'
|
125
|
-
addFinalMessages()
|
103
|
+
$response[:readerExecutionPass] = false
|
104
|
+
$response[:readerExecutionMessages] << 'Reader name was not provided'
|
126
105
|
return $response
|
127
106
|
else
|
128
107
|
require File.join(File.dirname(__FILE__), 'mdtranslator/readers/mdReaders')
|
129
108
|
intObj = ADIWG::Mdtranslator::Readers.handleReader(file)
|
130
109
|
|
131
|
-
if
|
110
|
+
# if readerExecutionPass is nil no error messages were set during exection
|
111
|
+
# and the execution is assumed to have been successful
|
112
|
+
if $response[:readerExecutionPass].nil?
|
132
113
|
$response[:readerExecutionPass] = true
|
133
|
-
|
134
|
-
addFinalMessages()
|
114
|
+
elsif !$response[:readerExecutionPass]
|
135
115
|
return $response
|
136
116
|
end
|
137
117
|
end
|
@@ -143,7 +123,6 @@ module ADIWG
|
|
143
123
|
require File.join(File.dirname(__FILE__), 'mdtranslator/writers/mdWriters')
|
144
124
|
ADIWG::Mdtranslator::Writers.handleWriter(intObj)
|
145
125
|
end
|
146
|
-
addFinalMessages()
|
147
126
|
return $response
|
148
127
|
|
149
128
|
end
|
@@ -127,6 +127,7 @@ class InternalMetadata
|
|
127
127
|
metadataCustodians: [],
|
128
128
|
metadataCreateDate: {},
|
129
129
|
metadataUpdateDate: {},
|
130
|
+
metadataCharacterSet: nil,
|
130
131
|
metadataURI: nil,
|
131
132
|
metadataStatus: nil,
|
132
133
|
maintInfo: {},
|
@@ -168,6 +169,7 @@ class InternalMetadata
|
|
168
169
|
graphicOverview: [],
|
169
170
|
resourceFormats: [],
|
170
171
|
resourceLanguages: [],
|
172
|
+
resourceCharacterSets: [],
|
171
173
|
descriptiveKeywords: [],
|
172
174
|
resourceUses: [],
|
173
175
|
useConstraints: [],
|
@@ -12,6 +12,7 @@
|
|
12
12
|
# Stan Smith 2014-12-01 add data dictionary
|
13
13
|
# Stan Smith 2014-12-03 changed class name to MdJsonReader from AdiwgJsonReader
|
14
14
|
# Stan Smith 2014-12-11 refactored to handle namespacing readers and writers
|
15
|
+
# Stan Smith 2015-06-12 added method to lookup contact in contact array
|
15
16
|
|
16
17
|
require 'json'
|
17
18
|
|
@@ -51,8 +52,13 @@ module ADIWG
|
|
51
52
|
|
52
53
|
# load mdJson file into internal object
|
53
54
|
require readerModule('module_mdJson')
|
54
|
-
|
55
|
-
|
55
|
+
# instance classes needed in script
|
56
|
+
intMetadataClass = InternalMetadata.new
|
57
|
+
|
58
|
+
# create new internal metadata container for the reader
|
59
|
+
@intObj = intMetadataClass.newBase
|
60
|
+
$ReaderNS.unpack(@intObj, @hMdJson)
|
61
|
+
return @intObj
|
56
62
|
|
57
63
|
end
|
58
64
|
|
@@ -164,6 +170,19 @@ module ADIWG
|
|
164
170
|
return file
|
165
171
|
end
|
166
172
|
|
173
|
+
# find the array pointer for a contact
|
174
|
+
def self.findContact(contactId)
|
175
|
+
pointer = nil
|
176
|
+
i = 0
|
177
|
+
@intObj[:contacts].each do |contact|
|
178
|
+
if contact[:contactId] == contactId
|
179
|
+
pointer = i
|
180
|
+
end
|
181
|
+
i += 1
|
182
|
+
end
|
183
|
+
return pointer
|
184
|
+
end
|
185
|
+
|
167
186
|
end
|
168
187
|
end
|
169
188
|
end
|
@@ -37,19 +37,21 @@ module ADIWG
|
|
37
37
|
intCont = intMetadataClass.newContact
|
38
38
|
|
39
39
|
# contact ID - required
|
40
|
-
#
|
40
|
+
# each contact must have a 'contactId' provided by the user
|
41
|
+
# ... the contactId is used by responsibleParty to reference a contact
|
42
|
+
# ... return nil contact if contactId is '' or missing
|
41
43
|
if hContact.has_key?('contactId')
|
42
44
|
s = hContact['contactId']
|
43
45
|
if s != ''
|
44
46
|
intCont[:contactId] = s
|
45
47
|
else
|
46
48
|
$response[:readerExecutionPass] = false
|
47
|
-
$response[:readerExecutionMessages] << '
|
49
|
+
$response[:readerExecutionMessages] << 'contact: {contactId: } is blank.'
|
48
50
|
return nil
|
49
51
|
end
|
50
52
|
else
|
51
53
|
$response[:readerExecutionPass] = false
|
52
|
-
$response[:readerExecutionMessages] << '
|
54
|
+
$response[:readerExecutionMessages] << 'contact: {contactId: } is missing.'
|
53
55
|
return nil
|
54
56
|
end
|
55
57
|
|
@@ -5,6 +5,7 @@
|
|
5
5
|
# Stan Smith 2014-12-12 original script
|
6
6
|
# Stan Smith 2014-12-15 refactored to handle namespacing readers and writers
|
7
7
|
# Stan Smith 2015-02-17 added support for multiple data dictionaries
|
8
|
+
# Stan Smith 2015-06-12 moved instantiation of intObj up to module mdJson_reader.rb
|
8
9
|
|
9
10
|
require $ReaderNS.readerModule('module_contacts')
|
10
11
|
require $ReaderNS.readerModule('module_metadata')
|
@@ -16,13 +17,7 @@ module ADIWG
|
|
16
17
|
module Readers
|
17
18
|
module MdJson
|
18
19
|
|
19
|
-
def self.unpack(hMdJson)
|
20
|
-
|
21
|
-
# instance classes needed in script
|
22
|
-
intMetadataClass = InternalMetadata.new
|
23
|
-
|
24
|
-
# create new internal metadata container for the reader
|
25
|
-
intObj = intMetadataClass.newBase
|
20
|
+
def self.unpack(intObj, hMdJson)
|
26
21
|
|
27
22
|
# get json schema name and version
|
28
23
|
hVersion = hMdJson['version']
|
@@ -31,8 +26,6 @@ module ADIWG
|
|
31
26
|
|
32
27
|
# contact array
|
33
28
|
# load the array of contacts from the json input
|
34
|
-
# ... the program uses the 'contactId' provided by the user
|
35
|
-
# ... to reference a contact
|
36
29
|
if hMdJson.has_key?('contact')
|
37
30
|
aContacts = hMdJson['contact']
|
38
31
|
aContacts.each do |hContact|
|
@@ -45,14 +38,14 @@ module ADIWG
|
|
45
38
|
# add default contacts
|
46
39
|
intObj[:contacts].concat($ReaderNS::Contact.setDefaultContacts)
|
47
40
|
|
48
|
-
# metadata
|
41
|
+
# metadata section
|
49
42
|
# load metadata from the hash object
|
50
43
|
if hMdJson.has_key?('metadata')
|
51
44
|
hMetadata = hMdJson['metadata']
|
52
45
|
intObj[:metadata] = $ReaderNS::Metadata.unpack(hMetadata)
|
53
46
|
end
|
54
47
|
|
55
|
-
# data dictionary
|
48
|
+
# data dictionary section
|
56
49
|
if hMdJson.has_key?('dataDictionary')
|
57
50
|
aDictionary = hMdJson['dataDictionary']
|
58
51
|
aDictionary.each do |hDictionary|
|
@@ -8,6 +8,7 @@
|
|
8
8
|
# Stan Smith 2014-09-19 changed parent metadata identifier type citation json 0.8.0
|
9
9
|
# Stan Smith 2014-11-06 removed metadataScope, moved to resourceType under resourceInfo json 0.9.0
|
10
10
|
# Stan Smith 2014-12-15 refactored to handle namespacing readers and writers
|
11
|
+
# Stan Smith 2015-06-12 added support for metadataCharacterSet
|
11
12
|
|
12
13
|
require $ReaderNS.readerModule('module_responsibleParty')
|
13
14
|
require $ReaderNS.readerModule('module_dateTime')
|
@@ -76,6 +77,14 @@ module ADIWG
|
|
76
77
|
end
|
77
78
|
end
|
78
79
|
|
80
|
+
# metadata - characterSet - default 'utf8'
|
81
|
+
if hMetadataInfo.has_key?('metadataCharacterSet')
|
82
|
+
s = hMetadataInfo['metadataCharacterSet']
|
83
|
+
if s != ''
|
84
|
+
intMetadataInfo[:metadataCharacterSet] = s
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
79
88
|
# metadata - metadata URI
|
80
89
|
if hMetadataInfo.has_key?('metadataUri')
|
81
90
|
s = hMetadataInfo['metadataUri']
|
@@ -16,6 +16,7 @@
|
|
16
16
|
# Stan Smith 2014-10-29 added support for resource time period
|
17
17
|
# Stan Smith 2014-11-06 added resourceType for 0.9.0
|
18
18
|
# Stan Smith 2014-12-15 refactored to handle namespacing readers and writers
|
19
|
+
# Stan Smith 2015-06-12 added support for resource characterSets
|
19
20
|
|
20
21
|
require $ReaderNS.readerModule('module_citation')
|
21
22
|
require $ReaderNS.readerModule('module_resourceIdentifier')
|
@@ -131,6 +132,14 @@ module ADIWG
|
|
131
132
|
end
|
132
133
|
end
|
133
134
|
|
135
|
+
# resource information - characterSet [] - default 'utf8'
|
136
|
+
if hResourceInfo.has_key?('characterSet')
|
137
|
+
aCharSet = hResourceInfo['characterSet']
|
138
|
+
aCharSet.each do |charSet|
|
139
|
+
intResInfo[:resourceCharacterSets] << charSet
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
134
143
|
# resource information - purpose
|
135
144
|
if hResourceInfo.has_key?('purpose')
|
136
145
|
s = hResourceInfo['purpose']
|
@@ -7,6 +7,8 @@
|
|
7
7
|
# ... removed resource IDs associated with contact
|
8
8
|
# Stan Smith 2014-12-15 refactored to handle namespacing readers and writers
|
9
9
|
# Stan Smith 2015-01-18 added nil return if hRParty empty
|
10
|
+
# Stan Smith 2015-06-12 added check that contactId for responsibleParty
|
11
|
+
# ... matches an actual contact in the contact array
|
10
12
|
|
11
13
|
module ADIWG
|
12
14
|
module Mdtranslator
|
@@ -30,6 +32,13 @@ module ADIWG
|
|
30
32
|
s = hRParty['contactId']
|
31
33
|
if s != ''
|
32
34
|
intResById[:contactId] = s
|
35
|
+
if (!$ReaderNS.findContact(s))
|
36
|
+
$response[:readerExecutionPass] = false
|
37
|
+
$response[:readerExecutionMessages] << "Responsible Party contact ID #{s} does not match with any contact provided\n"
|
38
|
+
end
|
39
|
+
else
|
40
|
+
$response[:readerExecutionPass] = false
|
41
|
+
$response[:readerExecutionMessages] << 'Responsible Party is missing the contact ID\n'
|
33
42
|
end
|
34
43
|
end
|
35
44
|
|
@@ -38,6 +47,9 @@ module ADIWG
|
|
38
47
|
s = hRParty['role']
|
39
48
|
if s != ''
|
40
49
|
intResById[:roleName] = s
|
50
|
+
else
|
51
|
+
$response[:readerExecutionPass] = false
|
52
|
+
$response[:readerExecutionMessages] << 'Responsible Party is missing the contact role\n'
|
41
53
|
end
|
42
54
|
end
|
43
55
|
|
@@ -38,11 +38,16 @@
|
|
38
38
|
# ... added local names to iso 19110 writer
|
39
39
|
# 1.0.0rc1 2015-02-27 schema 1.0 support
|
40
40
|
# 1.1.0 2015-04-13 added html writer
|
41
|
+
# 1.2.0 2015-06-12 added mdCodes for source of codelists
|
42
|
+
# --- added comments to XML headers for citation of ADIwg
|
43
|
+
# --- added reader and writer names to CLI help
|
44
|
+
# --- added check in responsibleParty for valid contactId
|
45
|
+
# --- added characterSets to resource and metadata, updated iso19115_2 and html writers
|
41
46
|
|
42
47
|
module ADIWG
|
43
48
|
module Mdtranslator
|
44
49
|
# current mdtranslator version
|
45
|
-
VERSION = "1.
|
50
|
+
VERSION = "1.2.0"
|
46
51
|
end
|
47
52
|
end
|
48
53
|
|
@@ -52,12 +52,15 @@ module ADIWG
|
|
52
52
|
logo = file.read
|
53
53
|
file.close
|
54
54
|
|
55
|
+
# side navigation
|
56
|
+
@html.div('id'=>'sideNav') do
|
55
57
|
# add top anchor and button
|
56
|
-
|
58
|
+
@html.a(' Top', {'href'=>'#', 'class'=>'btn icon-caret-up'})
|
57
59
|
|
58
|
-
|
59
|
-
|
60
|
-
|
60
|
+
# add open and close buttons
|
61
|
+
@html.span(' Open',{'id'=>'openAllDetails', 'class'=>'btn icon-caret-down', 'onclick'=>'openAllDetails();'})
|
62
|
+
@html.span(' Close',{'class'=>'btn icon-caret-right', 'onclick'=>'closeAllDetails();'})
|
63
|
+
end
|
61
64
|
|
62
65
|
# main header
|
63
66
|
@html.h2('id'=>'mainHeader') do
|
@@ -69,26 +69,34 @@ if ( typeof L === "object") {
|
|
69
69
|
geoArray.forEach(function(geo, geoIdx, geoArr) {
|
70
70
|
var json = JSON.parse(geo.textContent || geo.innerText);
|
71
71
|
var bbox = json.bbox;
|
72
|
+
|
73
|
+
if (!json.properties) {
|
74
|
+
json.properties = {};
|
75
|
+
}
|
76
|
+
|
72
77
|
if (json.geometry === null && bbox) {
|
73
78
|
json.geometry = {
|
74
79
|
"type": "Polygon",
|
75
80
|
"coordinates": [[[bbox[2], bbox[3]], [bbox[0], bbox[3]], [bbox[0], bbox[1]], [bbox[2], bbox[1]], [bbox[2], bbox[3]]]]
|
76
81
|
};
|
77
|
-
if (!json.properties) {
|
78
|
-
json.properties = {};
|
79
|
-
}
|
80
82
|
json.properties.style = {
|
81
83
|
color: '#f00',
|
82
84
|
fill: false
|
83
85
|
};
|
84
86
|
}
|
85
87
|
|
88
|
+
json.properties.popup = geo.getAttribute('data-popup');
|
86
89
|
geojson.push(json);
|
87
90
|
});
|
88
91
|
|
89
92
|
var geoLayer = L.geoJson(geojson, {
|
90
93
|
style: function(feature) {
|
91
94
|
return feature.properties.style || {};
|
95
|
+
},
|
96
|
+
onEachFeature: function (feature, layer) {
|
97
|
+
layer.bindPopup(feature.properties.popup,{
|
98
|
+
closeButton: false
|
99
|
+
});
|
92
100
|
}
|
93
101
|
}).addTo(map);
|
94
102
|
|
@@ -104,6 +112,16 @@ if ( typeof L === "object") {
|
|
104
112
|
|
105
113
|
}, map);
|
106
114
|
|
115
|
+
L.DomEvent.addListener(L.DomUtil.get('openAllDetails'), 'click', function() {
|
116
|
+
var me = this;
|
117
|
+
var i = 0;
|
118
|
+
|
119
|
+
setTimeout(function() {
|
120
|
+
check(i, me, bnds);
|
121
|
+
}, 100);
|
122
|
+
|
123
|
+
}, map);
|
124
|
+
|
107
125
|
map.fitBounds(bnds);
|
108
126
|
map.addLayer(new L.TileLayer.OSM());
|
109
127
|
});
|
@@ -132,7 +132,8 @@ module ADIWG
|
|
132
132
|
@html.em('GeoJSON format: ')
|
133
133
|
@html.section(:class=>'block') do
|
134
134
|
geoJson = AdiwgGeoFormat.internal_to_geoJson(hGeoEle)
|
135
|
-
|
135
|
+
popData = hGeoEle[:elementName] || hGeoEle[:elementDescription] || hGeoEle[:elementId]
|
136
|
+
@html.div({'id'=>'geojson-' + geoPre, 'class'=>'geojson', 'data-popup' => popData}) do
|
136
137
|
@html.text!(geoJson)
|
137
138
|
end
|
138
139
|
end
|