Skip to content

Commit 9fc87dd

Browse files
authored
add capability for generic extent object (geopython#111) (geopython#129)
1 parent 63a26d2 commit 9fc87dd

File tree

14 files changed

+125
-67
lines changed

14 files changed

+125
-67
lines changed

docs/content/reference/mcf.md

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,6 @@ Property Name|Mandatory/Optional|Description|Example|Reference
8181
-------------|------------------|-----------|-------|---------:
8282
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
8383
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
84-
crs|Mandatory|EPSG code identifier|4326|ISO 19115:2003 B.2.7.3
85-
bbox|Mandatory|geographic position of the dataset, formatted as 'minx,miny,maxx,maxy'|-141,42,-52,84|ISO 19115:2003 Section B.3.1.2
8684

8785
### `identification`
8886

@@ -109,15 +107,36 @@ rights_fr|Optional|Information about rights held in and over the resource (Frenc
109107
url|Mandatory|URL of the dataset to which the metadata applies|http://host/path/|ISO 19115:2003 Section B.2.1
110108
url_en|Optional|English URL of the dataset to which the metadata applies|http://host/path/|ISO 19115:2003 Section B.2.1
111109
url_fr|Optional|French URL of the dataset to which the metadata applies|http://host/path/|ISO 19115:2003 Section B.2.1
112-
temporal_begin|Mandatory|Starting time period covered by the content of the dataset, either time period (startdate/enddate) or a single point in time value|1950-07-31|ISO 19115:2003 Section B.3.1.3
113-
temporal_end|Mandatory|End time period covered by the content of the dataset, either time period (startdate/enddate) or a single point in time value. For data updated in realtime, use the term `now`|now|ISO 19115:2003 Section B.3.1.3
114110
status|Mandatory|"the status of the resource(s) (must be one of 'planned','historicalArchive','completed','onGoing', 'underDevelopment','required','obsolete')",completed,ISO 19115:2003 Section B.2.2.1
115111
maintenancefrequency|Mandatory|frequency with which modifications and deletions are made to the data after it is first produced (must be one of 'continual', 'daily', 'weekly', 'fortnightly', 'monthly', 'quarterly', 'biannually', 'annually', 'asNeeded', 'irregular', 'notPlanned', 'unknown'|continual|ISO 19115:2003 B.5.18
116112
browsegraphic|Optional|graphic that provides an illustration of the dataset|http://example.org/dataset.png|ISO 19115:2003 B.2.2.2
117113

114+
### `identification.extents`
115+
116+
MCF `identification.extents` sections can have 1..n `spatial` and `temporal` sections as required with the following properties.
117+
118+
Property Name|Mandatory/Optional|Description|Example|Reference
119+
-------------|------------------|-----------|-------|---------:
120+
bbox|Mandatory|geographic position of the dataset, formatted as as list of 'minx,miny,maxx,maxy'|-141,42,-52,84|ISO 19115:2003 Section B.3.1.2
121+
crs|Mandatory|EPSG code identifier|4326|ISO 19115:2003 B.2.7.3
122+
temporal.begin|Mandatory|Starting time period covered by the content of the dataset, either time period (startdate/enddate) or a single point in time value|1950-07-31|ISO 19115:2003 Section B.3.1.3
123+
temporal.end|Mandatory|End time period covered by the content of the dataset, either time period (startdate/enddate) or a single point in time value. For data updated in realtime, use the term `now`|now|ISO 19115:2003 Section B.3.1.3
124+
125+
```yaml
126+
identification:
127+
...
128+
extents:
129+
spatial:
130+
- bbox: [-141,42,-52,84]
131+
crs: 4326
132+
temporal:
133+
- begin: 1950-07-31
134+
end: now
135+
```
136+
118137
### `identification.keywords`
119138

120-
MCF `identification` sections can be 1..n `keywords` sections as required using nesting. Example:
139+
MCF `identification` sections can have 1..n `keywords` sections as required using nesting. Example:
121140

122141
```yaml
123142
identification:

pygeometa/core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,7 @@ def generate_metadata(ctx, mcf, schema, schema_local, output, verbosity):
442442
content = render_j2_template(mcf_dict, template_dir=schema_local)
443443

444444
if output is None:
445-
click.echo_via_pager(content)
445+
click.echo(content)
446446
else:
447447
output.write(content)
448448

pygeometa/schemas/iso19139/main.j2

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@
111111
</gmd:CI_Citation>
112112
</gmd:authority>
113113
<gmd:code>
114-
<gco:CharacterString>urn:ogc:def:crs:EPSG:{{ record['spatial']['crs'] }}</gco:CharacterString>
114+
<gco:CharacterString>urn:ogc:def:crs:EPSG:{{ record['identification']['extents']['spatial'][0]['crs'] }}</gco:CharacterString>
115115
</gmd:code>
116116
<gmd:version>
117117
<gco:CharacterString>6.18.3</gco:CharacterString>
@@ -212,19 +212,20 @@
212212
</gmd:topicCategory>
213213
{% endfor %}
214214
<gmd:extent>
215-
{% set bbox = record['spatial']['bbox'].split(',') %}
216215
<gmd:EX_Extent>
216+
{% for spatial in record['identification']['extents']['spatial'] %}
217+
{% set bbox = spatial['bbox'] %}
217218
<gmd:geographicElement>
218-
{% if record['spatial']['crs'] != 4326 %}
219+
{% if spatial['crs'] != 4326 %}
219220
<gmd:EX_BoundingPolygon>
220221
<gmd:extentTypeCode>
221222
<gco:Boolean>1</gco:Boolean>
222223
</gmd:extentTypeCode>
223224
<gmd:polygon>
224-
<gml:Polygon gml:id="P001" srsName="{{ record['spatial']['crs'] }}" srsDimension="2">
225+
<gml:Polygon gml:id="P001" srsName="{{ spatial['crs'] }}" srsDimension="2">
225226
<gml:exterior>
226227
<gml:LinearRing>
227-
<gml:posList srsName="{{ record['spatial']['crs'] }}" srsDimension="2">{{ bbox[0] }} {{ bbox[1] }} {{ bbox[0] }} {{ bbox[3] }} {{ bbox[2] }} {{ bbox[3] }} {{ bbox[2] }} {{ bbox[1] }} {{ bbox[0] }} {{ bbox[1] }}</gml:posList>
228+
<gml:posList srsName="{{ spatial['crs'] }}" srsDimension="2">{{ bbox[0] }} {{ bbox[1] }} {{ bbox[0] }} {{ bbox[3] }} {{ bbox[2] }} {{ bbox[3] }} {{ bbox[2] }} {{ bbox[1] }} {{ bbox[0] }} {{ bbox[1] }}</gml:posList>
228229
</gml:LinearRing>
229230
</gml:exterior>
230231
</gml:Polygon>
@@ -250,20 +251,23 @@
250251
</gmd:EX_GeographicBoundingBox>
251252
{% endif %}
252253
</gmd:geographicElement>
254+
{% endfor %}
255+
{% for temporal in record['identification']['extents']['temporal'] %}
253256
<gmd:temporalElement>
254257
<gmd:EX_TemporalExtent>
255258
<gmd:extent>
256259
<gml:TimePeriod gml:id="T001">
257-
<gml:beginPosition>{{ record['identification']['temporal_begin'] }}</gml:beginPosition>
258-
{% if record['identification']['temporal_end'] == 'now' %}
260+
<gml:beginPosition>{{ temporal['begin'] }}</gml:beginPosition>
261+
{% if temporal['end'] == 'now' %}
259262
<gml:endPosition indeterminatePosition="now"/>
260263
{% else %}
261-
<gml:endPosition>{{ record['identification']['temporal_end'] }}</gml:endPosition>
264+
<gml:endPosition>{{ temporal['end'] }}</gml:endPosition>
262265
{% endif %}
263266
</gml:TimePeriod>
264267
</gmd:extent>
265268
</gmd:EX_TemporalExtent>
266269
</gmd:temporalElement>
270+
{% endfor %}
267271
</gmd:EX_Extent>
268272
</gmd:extent>
269273
{{ cs.get_freetext('supplementalInformation', record['metadata']['language_alternate'], get_charstring('url', record['identification'], record['metadata']['language'], record['metadata']['language_alternate'])) }}

pygeometa/schemas/iso19139_hnap/main.j2

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@
131131
</gmd:CI_Citation>
132132
</gmd:authority>
133133
<gmd:code>
134-
<gco:CharacterString>urn:ogc:def:crs:EPSG:{{ record['spatial']['crs'] }}</gco:CharacterString>
134+
<gco:CharacterString>urn:ogc:def:crs:EPSG:{{ record['identification']['extents']['spatial'][0]['crs'] }}</gco:CharacterString>
135135
</gmd:code>
136136
<gmd:version>
137137
<gco:CharacterString>6.18.3</gco:CharacterString>
@@ -415,19 +415,20 @@
415415
</gmd:topicCategory>
416416
{% endfor %}
417417
<gmd:extent>
418-
{% set bbox = record['spatial']['bbox'].split(',') %}
419418
<gmd:EX_Extent>
419+
{% for spatial in record['identification']['extents']['spatial'] %}
420+
{% set bbox = spatial['bbox'] %}
420421
<gmd:geographicElement>
421-
{% if record['spatial']['crs'] != 4326 %}
422+
{% if spatial['crs'] != 4326 %}
422423
<gmd:EX_BoundingPolygon>
423424
<gmd:extentTypeCode>
424425
<gco:Boolean>1</gco:Boolean>
425426
</gmd:extentTypeCode>
426427
<gmd:polygon>
427-
<gml:Polygon gml:id="P001" srsName="{{ record['spatial']['crs'] }}" srsDimension="2">
428+
<gml:Polygon gml:id="P001" srsName="{{ spatial['crs'] }}" srsDimension="2">
428429
<gml:exterior>
429430
<gml:LinearRing>
430-
<gml:posList srsName="{{ record['spatial']['crs'] }}" srsDimension="2">{{ bbox[0] }} {{ bbox[1] }} {{ bbox[0] }} {{ bbox[3] }} {{ bbox[2] }} {{ bbox[3] }} {{ bbox[2] }} {{ bbox[1] }} {{ bbox[0] }} {{ bbox[1] }}</gml:posList>
431+
<gml:posList srsName="{{ spatial['crs'] }}" srsDimension="2">{{ bbox[0] }} {{ bbox[1] }} {{ bbox[0] }} {{ bbox[3] }} {{ bbox[2] }} {{ bbox[3] }} {{ bbox[2] }} {{ bbox[1] }} {{ bbox[0] }} {{ bbox[1] }}</gml:posList>
431432
</gml:LinearRing>
432433
</gml:exterior>
433434
</gml:Polygon>
@@ -453,20 +454,23 @@
453454
</gmd:EX_GeographicBoundingBox>
454455
{% endif %}
455456
</gmd:geographicElement>
457+
{% endfor %}
458+
{% for temporal in record['identification']['extents']['temporal'] %}
456459
<gmd:temporalElement>
457460
<gmd:EX_TemporalExtent>
458461
<gmd:extent>
459462
<gml:TimePeriod gml:id="T001">
460-
<gml:beginPosition>{{ record['identification']['temporal_begin'] }}</gml:beginPosition>
461-
{% if record['identification']['temporal_end'] == 'now' %}
463+
<gml:beginPosition>{{ temporal['begin'] }}</gml:beginPosition>
464+
{% if temporal['end'] == 'now' %}
462465
<gml:endPosition indeterminatePosition="now"/>
463466
{% else %}
464-
<gml:endPosition>{{ record['identification']['temporal_end'] }}</gml:endPosition>
467+
<gml:endPosition>{{ temporal['end'] }}</gml:endPosition>
465468
{% endif %}
466469
</gml:TimePeriod>
467470
</gmd:extent>
468471
</gmd:EX_TemporalExtent>
469472
</gmd:temporalElement>
473+
{% endfor %}
470474
</gmd:EX_Extent>
471475
</gmd:extent>
472476
{{ cs.get_freetext('supplementalInformation', 'fra', get_charstring('url', record['identification'], 'en', 'fr')) }}

pygeometa/schemas/wmo_cmp/main.j2

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@
111111
</gmd:CI_Citation>
112112
</gmd:authority>
113113
<gmd:code>
114-
<gco:CharacterString>urn:ogc:def:crs:EPSG:{{ record['spatial']['crs'] }}</gco:CharacterString>
114+
<gco:CharacterString>urn:ogc:def:crs:EPSG:{{ record['identification']['extents']['spatial'][0]['crs'] }}</gco:CharacterString>
115115
</gmd:code>
116116
<gmd:version>
117117
<gco:CharacterString>6.18.3</gco:CharacterString>
@@ -254,19 +254,20 @@
254254
</gmd:topicCategory>
255255
{% endfor %}
256256
<gmd:extent>
257-
{% set bbox = record['spatial']['bbox'].split(',') %}
258257
<gmd:EX_Extent>
258+
{% for spatial in record['identification']['extents']['spatial'] %}
259+
{% set bbox = spatial['bbox'] %}
259260
<gmd:geographicElement>
260-
{% if record['spatial']['crs'] != 4326 %}
261+
{% if spatial['crs'] != 4326 %}
261262
<gmd:EX_BoundingPolygon>
262263
<gmd:extentTypeCode>
263264
<gco:Boolean>1</gco:Boolean>
264265
</gmd:extentTypeCode>
265266
<gmd:polygon>
266-
<gml:Polygon gml:id="P001" srsName="{{ record['spatial']['crs'] }}" srsDimension="2">
267+
<gml:Polygon gml:id="P001" srsName="{{ spatial['crs'] }}" srsDimension="2">
267268
<gml:exterior>
268269
<gml:LinearRing>
269-
<gml:posList srsName="{{ record['spatial']['crs'] }}" srsDimension="2">{{ bbox[0] }} {{ bbox[1] }} {{ bbox[0] }} {{ bbox[3] }} {{ bbox[2] }} {{ bbox[3] }} {{ bbox[2] }} {{ bbox[1] }} {{ bbox[0] }} {{ bbox[1] }}</gml:posList>
270+
<gml:posList srsName="{{ spatial['crs'] }}" srsDimension="2">{{ bbox[0] }} {{ bbox[1] }} {{ bbox[0] }} {{ bbox[3] }} {{ bbox[2] }} {{ bbox[3] }} {{ bbox[2] }} {{ bbox[1] }} {{ bbox[0] }} {{ bbox[1] }}</gml:posList>
270271
</gml:LinearRing>
271272
</gml:exterior>
272273
</gml:Polygon>
@@ -292,20 +293,23 @@
292293
</gmd:EX_GeographicBoundingBox>
293294
{% endif %}
294295
</gmd:geographicElement>
296+
{% endfor %}
295297
<gmd:temporalElement>
298+
{% for temporal in record['identification']['extents']['temporal'] %}
296299
<gmd:EX_TemporalExtent>
297300
<gmd:extent>
298301
<gml:TimePeriod gml:id="T001">
299-
<gml:beginPosition>{{ record['identification']['temporal_begin'] }}</gml:beginPosition>
300-
{% if record['identification']['temporal_end'] == 'now' %}
302+
<gml:beginPosition>{{ temporal['begin'] }}</gml:beginPosition>
303+
{% if temporal['end'] == 'now' %}
301304
<gml:endPosition indeterminatePosition="now"/>
302305
{% else %}
303-
<gml:endPosition>{{ record['identification']['temporal_end'] }}</gml:endPosition>
306+
<gml:endPosition>{{ temporal['end'] }}</gml:endPosition>
304307
{% endif %}
305308
</gml:TimePeriod>
306309
</gmd:extent>
307310
</gmd:EX_TemporalExtent>
308311
</gmd:temporalElement>
312+
{% endfor %}
309313
</gmd:EX_Extent>
310314
</gmd:extent>
311315
{{ cs.get_freetext('supplementalInformation', record['metadata']['language_alternate'], get_charstring('url', record['identification'], record['metadata']['language'], record['metadata']['language_alternate'])) }}

sample.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ metadata:
1414
spatial:
1515
datatype: vector
1616
geomtype: point
17-
crs: 4326
18-
bbox: -141,42,-52,84
1917

2018
identification:
2119
language: eng; CAN
@@ -39,13 +37,18 @@ identification:
3937
keywords_fr: [kw1,kw2]
4038
topiccategory:
4139
- climatologyMeteorologyAtmosphere
40+
extents:
41+
spatial:
42+
- bbox: [-141,42,-52,84]
43+
crs: 4326
44+
temporal:
45+
- begin: 1950-07-31
46+
end: now
4247
fees: None
4348
accessconstraints: otherRestrictions
4449
rights_en: Copyright (c) 2010 Her Majesty the Queen in Right of Canada
4550
rights_fr: Copyright (c) 2010 Her Majesty the Queen in Right of Canada
4651
url: http://geogratis.ca/geogratis/en/product/search.do?id=08DB5E85-7405-FE3A-2860-CC3663245625
47-
temporal_begin: 1950-07-31
48-
temporal_end: now
4952
status: onGoing
5053
maintenancefrequency: continual
5154

tests/bad-version.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ metadata:
1414
spatial:
1515
datatype: vector
1616
geomtype: point
17-
crs: 4326
18-
bbox: -141,42,-52,84
1917

2018
identification:
2119
language: eng; CAN
@@ -39,13 +37,18 @@ identification:
3937
keywords_fr: [kw1,kw2]
4038
topiccategory:
4139
- climatologyMeteorologyAtmosphere
40+
extents:
41+
spatial:
42+
- bbox: [-141,42,-52,84]
43+
crs: 4326
44+
temporal:
45+
- begin: 1950-07-31
46+
end: now
4247
fees: None
4348
accessconstraints: otherRestrictions
4449
rights_en: Copyright (c) 2010 Her Majesty the Queen in Right of Canada
4550
rights_fr: Copyright (c) 2010 Her Majesty the Queen in Right of Canada
4651
url: http://geogratis.ca/geogratis/en/product/search.do?id=08DB5E85-7405-FE3A-2860-CC3663245625
47-
temporal_begin: 1950-07-31
48-
temporal_end: now
4952
status: onGoing
5053
maintenancefrequency: continual
5154

tests/broken-yaml.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ metadata:
1313
spatial:
1414
datatype: vector
1515
geomtype: point
16-
crs: 4326
17-
bbox: -141,42,-52,84
1816

1917
identification:
2018
language: fra; CAN
@@ -30,14 +28,19 @@ identification:
3028
topiccategory:
3129
- climatologyMeteorologyAtmosphere
3230
some-other-value: test
31+
extents:
32+
spatial:
33+
- bbox: [-141,42,-52,84]
34+
crs: 4326
35+
temporal:
36+
- begin: 1950-07-31
37+
end: now
3338
dates:
3439
publication: 2000-09-01T00:00:00Z
3540
fees: None
3641
accessconstraints: otherRestrictions
3742
rights_fr: Copyright (c) 2010 Her Majesty the Queen in Right of Canada
3843
url: http://geogratis.ca/geogratis/en/product/search.do?id=08DB5E85-7405-FE3A-2860-CC3663245625
39-
temporal_begin: 1950-07-31
40-
temporal_end: now
4144
status: onGoing
4245
maintenancefrequency: continual
4346

tests/dates-pre-1900.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ metadata:
1414
spatial:
1515
datatype: vector
1616
geomtype: point
17-
crs: 4326
18-
bbox: -141,42,-52,84
1917

2018
identification:
2119
language: eng; CAN
@@ -39,13 +37,18 @@ identification:
3937
keywords_fr: [kw1,kw2]
4038
topiccategory:
4139
- climatologyMeteorologyAtmosphere
40+
extents:
41+
spatial:
42+
- bbox: [-141,42,-52,84]
43+
crs: 4326
44+
temporal:
45+
- begin: 1950-07-31
46+
end: now
4247
fees: None
4348
accessconstraints: otherRestrictions
4449
rights_en: Copyright (c) 2010 Her Majesty the Queen in Right of Canada
4550
rights_fr: Copyright (c) 2010 Her Majesty the Queen in Right of Canada
4651
url: http://geogratis.ca/geogratis/en/product/search.do?id=08DB5E85-7405-FE3A-2860-CC3663245625
47-
temporal_begin: 1950-07-31
48-
temporal_end: now
4952
status: onGoing
5053
maintenancefrequency: continual
5154

tests/deep-nest-child.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ metadata:
1616
spatial:
1717
datatype: vector
1818
geomtype: point
19-
crs: 4326
20-
bbox: -141,42,-52,84
2119

2220
identification:
2321
language: eng; CAN
@@ -41,12 +39,17 @@ identification:
4139
keywords_fr: [kw1,kw2]
4240
topiccategory:
4341
- climatologyMeteorologyAtmosphere
42+
extents:
43+
spatial:
44+
- bbox: [-141,42,-52,84]
45+
crs: 4326
46+
temporal:
47+
- begin: 1950-07-31
48+
end: now
4449
fees: None
4550
accessconstraints: otherRestrictions
4651
rights_en: Copyright (c) 2010 Her Majesty the Queen in Right of Canada
4752
rights_fr: Copyright (c) 2010 Her Majesty the Queen in Right of Canada
4853
url: http://geogratis.ca/geogratis/en/product/search.do?id=08DB5E85-7405-FE3A-2860-CC3663245625
49-
temporal_begin: 1950-07-31
50-
temporal_end: now
5154
status: onGoing
5255
maintenancefrequency: continual

0 commit comments

Comments
 (0)