fix tile link relations (#1262) (#1264)

This commit is contained in:
Tom Kralidis
2023-06-15 02:18:55 -04:00
committed by GitHub
parent eb89c08ad0
commit 0237e4cbbd
3 changed files with 13 additions and 2 deletions
+9 -2
View File
@@ -1131,6 +1131,13 @@ class API:
try:
tile = get_provider_by_type(v['providers'], 'tile')
p = load_plugin('provider', tile)
except ProviderConnectionError:
msg = 'connection error (check logs)'
return self.get_exception(
HTTPStatus.INTERNAL_SERVER_ERROR,
headers, request.format,
'NoApplicableCode', msg)
except ProviderTypeError:
tile = None
@@ -1139,13 +1146,13 @@ class API:
LOGGER.debug('Adding tile links')
collection['links'].append({
'type': FORMAT_TYPES[F_JSON],
'rel': 'tiles',
'rel': f'http://www.opengis.net/def/rel/ogc/1.0/tilesets-{p.tile_type}', # noqa
'title': 'Tiles as JSON',
'href': f'{self.get_collections_url()}/{k}/tiles?f={F_JSON}' # noqa
})
collection['links'].append({
'type': FORMAT_TYPES[F_HTML],
'rel': 'tiles',
'rel': f'http://www.opengis.net/def/rel/ogc/1.0/tilesets-{p.tile_type}', # noqa
'title': 'Tiles as HTML',
'href': f'{self.get_collections_url()}/{k}/tiles?f={F_HTML}' # noqa
})
+3
View File
@@ -60,6 +60,9 @@ class MVTProvider(BaseTileProvider):
"""
super().__init__(provider_def)
self.tile_type = 'vector'
if is_url(self.data):
url = urlparse(self.data)
baseurl = f'{url.scheme}://{url.netloc}'
+1
View File
@@ -53,6 +53,7 @@ class BaseTileProvider:
self.format_type = provider_def['format']['name']
self.mimetype = provider_def['format']['mimetype']
self.options = provider_def.get('options')
self.tile_type = None
self.fields = {}
def get_layer(self):