diff --git a/docs/content/reference/mcf.md b/docs/content/reference/mcf.md index e1ce202..8bc5e75 100644 --- a/docs/content/reference/mcf.md +++ b/docs/content/reference/mcf.md @@ -129,6 +129,9 @@ Property Name|Mandatory/Optional|Description|Example|Reference -------------|------------------|-----------|-------|---------: datatype|Mandatory|method used to represent geographic information in the dataset (must be one of 'vector', 'grid', 'textTable', 'tin', 'stereoModel', 'video')|vector|Section B.5.26 geomtype|Mandatory|name of point or vector objects used to locate zero-, one-, two-, or threedimensional spatial locations in the dataset (must be one of 'complex', 'composite', 'curve', 'point', 'solid', 'surface')|point|ISO 19115:2003 B.5.15 +denominators|Optional|level of detail expressed as the scale of a comparable hardcopy map or chart|5000|ISO 19115:2003 Section B.2.2.5 +resolution.distance|Optional|ground sample distance|100|ISO 19115:2003 Section B.2.2.5 +resolution.uom|Optional|unit of measure of the distance|m|ISO 19115:2003 Section B.2.2.5 ### `identification` diff --git a/pygeometa/schemas/iso19139/__init__.py b/pygeometa/schemas/iso19139/__init__.py index 1c2998e..512630a 100644 --- a/pygeometa/schemas/iso19139/__init__.py +++ b/pygeometa/schemas/iso19139/__init__.py @@ -84,6 +84,7 @@ def import_(self, metadata: str) -> dict: 'version': '1.0', }, 'metadata': {}, + 'spatial': {}, 'identification': {}, 'contact': {}, 'distribution': {} @@ -158,7 +159,22 @@ def import_(self, metadata: str) -> dict: mcf['identification']['extents']['temporal'].append(temp_extent) - if identification.accessconstraints: + if hasattr(identification, 'denominators'): + mcf['spatial']['denominators'] = identification.denominators + + if hasattr(identification, 'distance'): + mcf['spatial']['resolution'] = [] + for k, v in enumerate(identification.distance): + uom = '' + if hasattr(identification, 'uom') and len(identification.uom) > k: # noqa + uom = identification.uom[k] + mcf['spatial']['resolution'].append({'distance': v, + 'uom': uom}) + + if hasattr(identification, 'spatialrepresentationtype') and len(identification.spatialrepresentationtype) > 0: # noqa + mcf['spatial']['datatype'] = identification.spatialrepresentationtype[0] # noqa + + if hasattr(identification, 'accessconstraints'): mcf['identification']['accessconstraints'] = identification.accessconstraints[0] # noqa mcf['identification']['status'] = identification.status diff --git a/pygeometa/schemas/iso19139/main.j2 b/pygeometa/schemas/iso19139/main.j2 index 069c3f0..f86a47e 100644 --- a/pygeometa/schemas/iso19139/main.j2 +++ b/pygeometa/schemas/iso19139/main.j2 @@ -247,6 +247,28 @@ {{ record['spatial']['datatype'] }} + {% for res in record['spatial']['resolutions'] %} + + + + {{ res['distance'] }} + + + + {% endfor %} + {% for d in record['spatial']['denominators'] %} + + + + + + {{ d }} + + + + + + {% endfor %} {% if record['identification']['language'] in ['inapplicable', 'missing', 'template', 'unknown', 'withheld'] %} {% else %} diff --git a/pygeometa/schemas/mcf/core.yaml b/pygeometa/schemas/mcf/core.yaml index 0b858a7..bb79c28 100644 --- a/pygeometa/schemas/mcf/core.yaml +++ b/pygeometa/schemas/mcf/core.yaml @@ -89,6 +89,27 @@ properties: - point - solid - surface + denominators: + type: array + description: one or two (min-max) denominators to indicate the scale of the resource + items: + type: integer + resolutions: + type: array + description: one or two (min-max) distance values + uom to indicate the resolution of the resource + properties: + distance: + type: number + uom: + type: string + description: the unit of measure of the distance value + enum: + - m + - km + - feet + - mile + - degree + - parsec required: - datatype - geomtype diff --git a/tests/md-SMJP01RJTD-gmd.xml b/tests/md-SMJP01RJTD-gmd.xml index 7bdb7ef..73fee26 100644 --- a/tests/md-SMJP01RJTD-gmd.xml +++ b/tests/md-SMJP01RJTD-gmd.xml @@ -315,6 +315,20 @@ + + + + + + + + + 10000 + + + + + eng