Fixing error when retrieving the TMS in vector tiles that do not provide tilejson metadata (#1288)
* - look for metadata.json, only when we are using the tilejson format; in other cases, this file is missing and that is going to make pygeoapi fail
* - updated configuration examples in documentation, to use "default" as metadata for vector tiles ("raw" does not work)
- added metadata format configuration for the pg_tileserv provider example
This commit is contained in:
@@ -54,7 +54,7 @@ This code block shows how to configure pygeoapi to read Mapbox vector tiles, fro
|
||||
data: tests/data/tiles/ne_110m_lakes # local directory tree
|
||||
# data: http://localhost:9000/ne_110m_lakes/{z}/{x}/{y}.pbf # tiles stored on a MinIO bucket
|
||||
options:
|
||||
metadata_format: raw # default | tilejson
|
||||
metadata_format: default # default | tilejson
|
||||
zoom:
|
||||
min: 0
|
||||
max: 5
|
||||
@@ -75,7 +75,7 @@ This code block shows how to configure pygeoapi to read Mapbox vector tiles, fro
|
||||
# if you don't use precision 0, you will be requesting for aggregations which are not supported in the
|
||||
# free version of elastic
|
||||
options:
|
||||
metadata_format: raw # default | tilejson
|
||||
metadata_format: default # default | tilejson
|
||||
zoom:
|
||||
min: 0
|
||||
max: 5
|
||||
@@ -94,6 +94,7 @@ This code block shows how to configure pygeoapi to read Mapbox vector tiles, fro
|
||||
name: MVT
|
||||
data: http://localhost:7800/public.ne_50m_admin_0_countries/{z}/{x}/{y}.pbf
|
||||
options:
|
||||
metadata_format: default # default | tilejson
|
||||
zoom:
|
||||
min: 0
|
||||
max: 16
|
||||
|
||||
@@ -257,11 +257,12 @@ class MVTProvider(BaseTileProvider):
|
||||
if is_url(self.data):
|
||||
url = urlparse(self.data)
|
||||
base_url = f'{url.scheme}://{url.netloc}'
|
||||
with requests.Session() as session:
|
||||
session.get(base_url)
|
||||
resp = session.get(f'{base_url}/{layer}/metadata.json')
|
||||
resp.raise_for_status()
|
||||
metadata_json_content = resp.json()
|
||||
if metadata_format == TilesMetadataFormat.TILEJSON:
|
||||
with requests.Session() as session:
|
||||
session.get(base_url)
|
||||
resp = session.get(f'{base_url}/{layer}/metadata.json')
|
||||
resp.raise_for_status()
|
||||
metadata_json_content = resp.json()
|
||||
else:
|
||||
if not isinstance(self.service_metadata_url, Path):
|
||||
msg = f'Wrong data path configuration: {self.service_metadata_url}' # noqa
|
||||
|
||||
Reference in New Issue
Block a user