@@ -208,7 +208,15 @@ const mapEDPubToUmmc = async (formData) => {
208
208
209
209
// Strip nulls and empty objects
210
210
tmpArr = tmpArr . filter ( ( value ) => Object . keys ( stripNullsFromObject ( value ) ) . length !== 0 ) ;
211
- spatialExtent . SpatialExtent . HorizontalSpatialDomain . Geometry . BoundingRectangles = spatialExtent . SpatialExtent . HorizontalSpatialDomain . Geometry . BoundingRectangles . concat ( tmpArr ) ;
211
+
212
+ if ( tmpArr . length > 0 ) {
213
+ // If coordinate array not empty, populate metadata object
214
+ spatialExtent . SpatialExtent . HorizontalSpatialDomain . Geometry . BoundingRectangles = spatialExtent . SpatialExtent . HorizontalSpatialDomain . Geometry . BoundingRectangles . concat ( tmpArr ) ;
215
+ } else {
216
+ // Otherwise, remove empty metadata field
217
+ Object . keys ( spatialExtent ) . forEach ( ( key ) => { delete spatialExtent [ key ] ; } ) ;
218
+ }
219
+
212
220
// Delete spatial extent information
213
221
[ 'west' , 'north' , 'east' , 'south' ] . forEach ( ( direction ) => {
214
222
[ 1 , 2 , 3 ] . forEach ( ( directionSet ) => {
@@ -630,14 +638,6 @@ const mapEDPubToUmmc = async (formData) => {
630
638
]
631
639
} ;
632
640
633
- const metadataSpecification = {
634
- MetadataSpecification : {
635
- URL : 'https://cdn.earthdata.nasa.gov/umm/collection/v1.17.0' ,
636
- Name : 'UMM-C' ,
637
- Version : '1.17.0'
638
- }
639
- } ;
640
-
641
641
// Added to capture DAAC specific questions
642
642
Object . keys ( formData ) . forEach ( ( extra ) => {
643
643
additionalAttributes . push ( {
@@ -662,8 +662,7 @@ const mapEDPubToUmmc = async (formData) => {
662
662
...( temporalExtent || { } ) ,
663
663
...( spatialExtent || { } ) ,
664
664
...( additionalAttributes ? { AdditionalAttributes : additionalAttributes } : { } ) ,
665
- ...( metadataDates || { } ) ,
666
- ...( metadataSpecification || { } )
665
+ ...( metadataDates || { } )
667
666
} ) ) ;
668
667
} ;
669
668
0 commit comments