From 9a18b38813aabf28f8c391cbc62e9e50564cb946 Mon Sep 17 00:00:00 2001 From: paul van genuchten Date: Tue, 20 Dec 2022 15:09:18 +0100 Subject: [PATCH] add scale/resolution to spatial section resolves #189 --- pygeometa/schemas/iso19139/__init__.py | 12 ++++++++++++ pygeometa/schemas/iso19139/main.j2 | 22 ++++++++++++++++++++++ pygeometa/schemas/mcf/core.yaml | 26 ++++++++++++++++++++++++++ tests/md-SMJP01RJTD-gmd.xml | 11 +++++++++++ 4 files changed, 71 insertions(+) diff --git a/pygeometa/schemas/iso19139/__init__.py b/pygeometa/schemas/iso19139/__init__.py index 47e4198..3d60c36 100644 --- a/pygeometa/schemas/iso19139/__init__.py +++ b/pygeometa/schemas/iso19139/__init__.py @@ -82,6 +82,7 @@ def import_(self, metadata: str) -> dict: 'version': '1.0', }, 'metadata': {}, + 'spatial': {}, 'identification': {}, 'contact': {}, 'distribution': {} @@ -138,6 +139,17 @@ def import_(self, metadata: str) -> dict: mcf['identification']['extents']['temporal'].append(temp_extent) + if m.identification.denominators: + mcf['spatial']['denominators'] = m.identification.denominators + + if m.identification.distance: + mcf['spatial']['resolution'] = [] + for k, v in enumerate(m.identification.distance): + uom = '' + if m.identification.uom and len(m.identification.uom) > k: + uom = m.identification.uom[k] + mcf['spatial']['resolution'].append({'distance': v, 'uom': uom}) + if m.identification.accessconstraints: mcf['identification']['accessconstraints'] = m.identification.accessconstraints[0] # noqa diff --git a/pygeometa/schemas/iso19139/main.j2 b/pygeometa/schemas/iso19139/main.j2 index efc8ecd..6d357ad 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 dac91e3..3f78ae6 100644 --- a/pygeometa/schemas/mcf/core.yaml +++ b/pygeometa/schemas/mcf/core.yaml @@ -89,6 +89,32 @@ 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 + + distance: + + uom: + required: - datatype - geomtype diff --git a/tests/md-SMJP01RJTD-gmd.xml b/tests/md-SMJP01RJTD-gmd.xml index 7bdb7ef..e655a6d 100644 --- a/tests/md-SMJP01RJTD-gmd.xml +++ b/tests/md-SMJP01RJTD-gmd.xml @@ -315,6 +315,17 @@ + + + + + + 10000 + + + + + eng