Skip to content

Commit de84a31

Browse files
authored
Merge pull request #171 from OpenGeoMetadata/fix-geometry-crosswalk
Ensure that locn_geometry is populated when migrating v1 to Aardvark
2 parents b9fe396 + 34451a5 commit de84a31

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

lib/geo_combine/migrators/v1_aardvark_migrator.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,17 @@ def convert_single_to_multi_valued_fields
5050
end
5151

5252
# Convert non-crosswalked fields via lookup tables
53+
# rubocop:disable Metrics/PerceivedComplexity
5354
def convert_non_crosswalked_fields
5455
# Keys may or may not include whitespace, so we normalize them.
5556
# Resource class is required so we default to "Other"; resource type is not required.
5657
@v2_hash['gbl_resourceClass_sm'] = RESOURCE_CLASS_MAP[@v1_hash['dc_type_s']&.gsub(/\s+/, '')] || ['Other']
5758
resource_type = RESOURCE_TYPE_MAP[@v1_hash['layer_geom_type_s']&.gsub(/\s+/, '')]
5859
@v2_hash['gbl_resourceType_sm'] = resource_type unless resource_type.nil?
5960

61+
# If locn_geometry is in the ENVELOPE format, also add it as dcat_bbox
62+
@v2_hash['dcat_bbox'] = @v2_hash['locn_geometry'] if @v2_hash['locn_geometry']&.match?(/ENVELOPE/)
63+
6064
# If the user specified a collection id map, use it to convert the collection names to ids
6165
is_part_of = @v1_hash['dct_isPartOf_sm']&.map { |name| @collection_id_map[name] }&.compact
6266
if is_part_of.present?
@@ -65,6 +69,7 @@ def convert_non_crosswalked_fields
6569
@v2_hash.delete('dct_isPartOf_sm')
6670
end
6771
end
72+
# rubocop:enable Metrics/PerceivedComplexity
6873

6974
# Remove fields that are no longer used
7075
def remove_deprecated_fields
@@ -80,7 +85,7 @@ def remove_deprecated_fields
8085
'dc_publisher_s' => 'dct_publisher_sm', # new namespace; single to multi-valued
8186
'dct_provenance_s' => 'schema_provider_s', # new URI name
8287
'dc_subject_sm' => 'dct_subject_sm', # new namespace
83-
'solr_geom' => 'dcat_bbox', # new URI name
88+
'solr_geom' => 'locn_geometry', # new URI name
8489
'solr_year_i' => 'gbl_indexYear_im', # new URI name; single to multi-valued
8590
'dc_source_sm' => 'dct_source_sm', # new namespace
8691
'dc_rights_s' => 'dct_accessRights_s', # new URI name

spec/fixtures/docs/full_geoblacklight_aardvark.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
"stanford-rb371kw9607"
4545
],
4646
"dcat_bbox":"ENVELOPE(29.572742, 35.000308, 4.234077, -1.478794)",
47+
"locn_geometry":"ENVELOPE(29.572742, 35.000308, 4.234077, -1.478794)",
4748
"gbl_indexYear_im":[
4849
2005
4950
],

0 commit comments

Comments
 (0)