fix EDR HTML breadcrumbs (#1764)
* fix EDR HTML breadcrumbs * add translations * do not include CoverageJSON to format types * set JSON-LD link for HTML templating * add Locations and Instances to translations
This commit is contained in:
@@ -656,3 +656,27 @@ msgstr ""
|
||||
|
||||
msgid "not specified"
|
||||
msgstr ""
|
||||
|
||||
msgid "Position"
|
||||
msgstr ""
|
||||
|
||||
msgid "Cube"
|
||||
msgstr ""
|
||||
|
||||
msgid "Area"
|
||||
msgstr ""
|
||||
|
||||
msgid "Corridor"
|
||||
msgstr ""
|
||||
|
||||
msgid "Trajectory"
|
||||
msgstr ""
|
||||
|
||||
msgid "Radius"
|
||||
msgstr ""
|
||||
|
||||
msgid "Locations"
|
||||
msgstr ""
|
||||
|
||||
msgid "Instances"
|
||||
msgstr ""
|
||||
|
||||
@@ -706,3 +706,27 @@ msgstr ""
|
||||
|
||||
msgid "not specified"
|
||||
msgstr ""
|
||||
|
||||
msgid "Position"
|
||||
msgstr ""
|
||||
|
||||
msgid "Cube"
|
||||
msgstr ""
|
||||
|
||||
msgid "Area"
|
||||
msgstr ""
|
||||
|
||||
msgid "Corridor"
|
||||
msgstr ""
|
||||
|
||||
msgid "Trajectory"
|
||||
msgstr ""
|
||||
|
||||
msgid "Radius"
|
||||
msgstr ""
|
||||
|
||||
msgid "Locations"
|
||||
msgstr ""
|
||||
|
||||
msgid "Instances"
|
||||
msgstr ""
|
||||
|
||||
@@ -708,3 +708,27 @@ msgstr ""
|
||||
|
||||
msgid "not specified"
|
||||
msgstr ""
|
||||
|
||||
msgid "Position"
|
||||
msgstr ""
|
||||
|
||||
msgid "Cube"
|
||||
msgstr ""
|
||||
|
||||
msgid "Area"
|
||||
msgstr ""
|
||||
|
||||
msgid "Corridor"
|
||||
msgstr ""
|
||||
|
||||
msgid "Trajectory"
|
||||
msgstr ""
|
||||
|
||||
msgid "Radius"
|
||||
msgstr ""
|
||||
|
||||
msgid "Locations"
|
||||
msgstr ""
|
||||
|
||||
msgid "Instances"
|
||||
msgstr ""
|
||||
|
||||
@@ -521,3 +521,27 @@ msgstr ""
|
||||
|
||||
msgid "not specified"
|
||||
msgstr ""
|
||||
|
||||
msgid "Position"
|
||||
msgstr ""
|
||||
|
||||
msgid "Cube"
|
||||
msgstr ""
|
||||
|
||||
msgid "Area"
|
||||
msgstr ""
|
||||
|
||||
msgid "Corridor"
|
||||
msgstr ""
|
||||
|
||||
msgid "Trajectory"
|
||||
msgstr ""
|
||||
|
||||
msgid "Radius"
|
||||
msgstr ""
|
||||
|
||||
msgid "Locations"
|
||||
msgstr ""
|
||||
|
||||
msgid "Instances"
|
||||
msgstr ""
|
||||
|
||||
@@ -715,3 +715,27 @@ msgstr ""
|
||||
|
||||
msgid "not specified"
|
||||
msgstr ""
|
||||
|
||||
msgid "Position"
|
||||
msgstr ""
|
||||
|
||||
msgid "Cube"
|
||||
msgstr ""
|
||||
|
||||
msgid "Area"
|
||||
msgstr ""
|
||||
|
||||
msgid "Corridor"
|
||||
msgstr ""
|
||||
|
||||
msgid "Trajectory"
|
||||
msgstr ""
|
||||
|
||||
msgid "Radius"
|
||||
msgstr ""
|
||||
|
||||
msgid "Locations"
|
||||
msgstr ""
|
||||
|
||||
msgid "Instances"
|
||||
msgstr ""
|
||||
|
||||
@@ -656,3 +656,27 @@ msgstr ""
|
||||
|
||||
msgid "not specified"
|
||||
msgstr ""
|
||||
|
||||
msgid "Position"
|
||||
msgstr ""
|
||||
|
||||
msgid "Cube"
|
||||
msgstr ""
|
||||
|
||||
msgid "Area"
|
||||
msgstr ""
|
||||
|
||||
msgid "Corridor"
|
||||
msgstr ""
|
||||
|
||||
msgid "Trajectory"
|
||||
msgstr ""
|
||||
|
||||
msgid "Radius"
|
||||
msgstr ""
|
||||
|
||||
msgid "Locations"
|
||||
msgstr ""
|
||||
|
||||
msgid "Instances"
|
||||
msgstr ""
|
||||
|
||||
@@ -80,6 +80,7 @@ HEADERS = {
|
||||
|
||||
CHARSET = ['utf-8']
|
||||
F_JSON = 'json'
|
||||
F_COVERAGEJSON = 'json'
|
||||
F_HTML = 'html'
|
||||
F_JSONLD = 'jsonld'
|
||||
F_GZIP = 'gzip'
|
||||
|
||||
@@ -41,10 +41,12 @@
|
||||
from http import HTTPStatus
|
||||
import logging
|
||||
from typing import Tuple
|
||||
import urllib
|
||||
|
||||
from shapely.errors import ShapelyError
|
||||
from shapely.wkt import loads as shapely_loads
|
||||
|
||||
from pygeoapi import l10n
|
||||
from pygeoapi.plugin import load_plugin, PLUGINS
|
||||
from pygeoapi.provider.base import ProviderGenericError
|
||||
from pygeoapi.util import (
|
||||
@@ -52,7 +54,8 @@ from pygeoapi.util import (
|
||||
to_json, filter_dict_by_key_value
|
||||
)
|
||||
|
||||
from . import APIRequest, API, F_HTML, validate_datetime, validate_bbox
|
||||
from . import (APIRequest, API, F_COVERAGEJSON, F_HTML, F_JSONLD,
|
||||
validate_datetime, validate_bbox)
|
||||
|
||||
LOGGER = logging.getLogger(__name__)
|
||||
|
||||
@@ -195,6 +198,36 @@ def get_collection_edr_query(api: API, request: APIRequest,
|
||||
err.ogc_exception_code, err.message)
|
||||
|
||||
if request.format == F_HTML: # render
|
||||
uri = f'{api.get_collections_url()}/{dataset}/{query_type}'
|
||||
serialized_query_params = ''
|
||||
for k, v in request.params.items():
|
||||
if k != 'f':
|
||||
serialized_query_params += '&'
|
||||
serialized_query_params += urllib.parse.quote(k, safe='')
|
||||
serialized_query_params += '='
|
||||
serialized_query_params += urllib.parse.quote(str(v), safe=',')
|
||||
|
||||
data['query_type'] = query_type.capitalize()
|
||||
data['query_path'] = uri
|
||||
data['dataset_path'] = '/'.join(uri.split('/')[:-1])
|
||||
data['collections_path'] = api.get_collections_url()
|
||||
|
||||
data['links'] = [{
|
||||
'rel': 'collection',
|
||||
'title': collections[dataset]['title'],
|
||||
'href': data['dataset_path']
|
||||
}, {
|
||||
'type': 'application/prs.coverage+json',
|
||||
'rel': request.get_linkrel(F_COVERAGEJSON),
|
||||
'title': l10n.translate('This document as CoverageJSON', request.locale), # noqa
|
||||
'href': f'{uri}?f={F_COVERAGEJSON}{serialized_query_params}'
|
||||
}, {
|
||||
'type': 'application/ld+json',
|
||||
'rel': 'alternate',
|
||||
'title': l10n.translate('This document as JSON-LD', request.locale), # noqa
|
||||
'href': f'{uri}?f={F_JSONLD}{serialized_query_params}'
|
||||
}]
|
||||
|
||||
content = render_j2_template(api.tpl_config,
|
||||
'collections/edr/query.html', data,
|
||||
api.default_locale)
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
{% set links_found = namespace(json=0, jsonld=0) %}
|
||||
|
||||
{% for link in data['links'] %}
|
||||
{% if link['rel'] == 'alternate' and link['type'] and link['type'] in ['application/json', 'application/geo+json'] %}
|
||||
{% if link['rel'] == 'alternate' and link['type'] and link['type'] in ['application/json', 'application/geo+json', 'application/prs.coverage+json'] %}
|
||||
{% set links_found.json = 1 %}
|
||||
<a href="{{ link['href'] }}">{% trans %}json{% endtrans %}</a>
|
||||
{% elif link['rel'] == 'alternate' and link['type'] and link['type'] == 'application/ld+json' %}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
{% set col_title = link['title'] %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
/ <a href="{{ data['items_path']}}">{% trans %}Items{% endtrans %}</a>
|
||||
/ <a href="{{ data['query_path']}}">{% trans query_type=data.query_type %}{{ query_type }}{% endtrans %}</a>
|
||||
{% endblock %}
|
||||
{% block extrahead %}
|
||||
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.3.1/dist/leaflet.css"/>
|
||||
|
||||
Reference in New Issue
Block a user