Skip to content

Commit 545f2c8

Browse files
committed
Fix mime type and links for items and item id
1 parent f0b85f7 commit 545f2c8

File tree

3 files changed

+19
-2
lines changed

3 files changed

+19
-2
lines changed

pygeoapi/api/__init__.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@
9595
(F_HTML, 'text/html'),
9696
(F_JSONLD, 'application/ld+json'),
9797
(F_JSON, 'application/json'),
98-
(F_JSONFG, 'application/vnd.geo+json'),
98+
(F_JSONFG, 'application/geo+json'),
9999
(F_JPEG, 'image/jpeg'),
100100
(F_MVT, 'application/vnd.mapbox-vector-tile'),
101101
(F_NETCDF, 'application/x-netcdf'),
@@ -1128,6 +1128,12 @@ def describe_collections(api: API, request: APIRequest,
11281128
'title': l10n.translate('Items as GeoJSON', request.locale), # noqa
11291129
'href': f'{api.get_collections_url()}/{k}/items?f={F_JSON}' # noqa
11301130
})
1131+
collection['links'].append({
1132+
'type': FORMAT_TYPES[F_JSONFG],
1133+
'rel': 'items',
1134+
'title': l10n.translate('Items as JSON-FG', request.locale), # noqa
1135+
'href': f'{api.get_collections_url()}/{k}/items?f={F_JSONFG}' # noqa
1136+
})
11311137
collection['links'].append({
11321138
'type': FORMAT_TYPES[F_JSONLD],
11331139
'rel': 'items',
@@ -1334,6 +1340,12 @@ def describe_collections(api: API, request: APIRequest,
13341340
'title': l10n.translate('This document as JSON', request.locale), # noqa
13351341
'href': f'{api.get_collections_url()}?f={F_JSON}'
13361342
})
1343+
fcm['links'].append({
1344+
'type': FORMAT_TYPES[F_JSONFG],
1345+
'rel': request.get_linkrel(F_JSONFG),
1346+
'title': l10n.translate('This document as JSON-FG', request.locale), # noqa
1347+
'href': f'{api.get_collections_url()}?f={F_JSONFG}'
1348+
})
13371349
fcm['links'].append({
13381350
'type': FORMAT_TYPES[F_JSONLD],
13391351
'rel': request.get_linkrel(F_JSONLD),

pygeoapi/api/itemtypes.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -574,6 +574,11 @@ def get_collection_items(
574574
'rel': request.get_linkrel(F_JSON),
575575
'title': l10n.translate('This document as GeoJSON', request.locale),
576576
'href': f'{uri}?f={F_JSON}{serialized_query_params}'
577+
}, {
578+
'rel': request.get_linkrel(F_JSONFG),
579+
'type': FORMAT_TYPES[F_JSONFG],
580+
'title': l10n.translate('This document as JSON-FG', request.locale), # noqa
581+
'href': f'{uri}?f={F_JSONFG}{serialized_query_params}'
577582
}, {
578583
'rel': request.get_linkrel(F_JSONLD),
579584
'type': FORMAT_TYPES[F_JSONLD],

pygeoapi/formatter/jsonfg.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def __init__(self, formatter_def: dict):
5959
geom = formatter_def["geom"]
6060

6161
super().__init__({"name": "jsonfg", "geom": geom})
62-
self.mimetype = "application/vnd.ogc.fg+json"
62+
self.mimetype = "application/geo+json"
6363

6464
def write(self, data: dict, options: dict = {}) -> str:
6565
"""

0 commit comments

Comments
 (0)