pygeoapi icon indicating copy to clipboard operation
pygeoapi copied to clipboard

Add metadata path property for Tiles provider to config

Open KoalaGeo opened this issue 3 years ago • 4 comments

Is your feature request related to a problem? Please describe. I'm trying using pg_tileserv for Vector Tiles, connected to pygeoapi. It's almost there, see above works , but metadata doesn't come through : requests.exceptions.HTTPError: 404 Client Error: Not Found for url: http://pg-tileserve-2076-master.kube-idev.bgslcdevops.test/landslides.observation_with_geometry/metadata.json

The metadata is at http://pg-tileserve-2076-master.kube-idev.bgslcdevops.test/landslides.observation_with_geometry.json but pygeoapi is expecting it at http://pg-tileserve-2076-master.kube-idev.bgslcdevops.test/landslides.observation_with_geometry/metadata/landslides.observation_with_geometry.json

Describe the solution you'd like From Gitter

KoalaGeo @KoalaGeo Nov 10 17:24 - https://gitter.im/geopython/pygeoapi?at=618c005038377967f4a4a2ab Could I do some sort IF statement at https://github.com/geopython/pygeoapi/blob/8740b23e235c849145c596aac87f61814cf732a0/pygeoapi/provider/mvt.py#L74 For both URL patterns

Francesco Bartoli @francbartoli Nov 10 18:25 - https://gitter.im/geopython/pygeoapi?at=618c0eaad78911028a2f1a25 Yes @KoalaGeo, it’s likely there is a space for improvements there for example when the service is recalling a backend mvt server. Maybe it makes sense to have an additional propetry like a metadata_path in the config file more or less here - https://github.com/geopython/demo.pygeoapi.io/blob/master/services/pygeoapi_master/local.config.yml#L154

Describe alternatives you've considered Amend pg_tileserv to change the path it writes the metadata.json

KoalaGeo avatar Nov 24 '21 00:11 KoalaGeo

Suggest making the metadata path explicit in the config:

providers:
    - type: tile
      name: MVT
      data: tests/data/tiles/ne_110m_lakes  # local directory tree
      # data: https://example.org/ne_110m_lakes/{z}/{x}/{y}.pbf
      metadata: https://example.org/ne_110m_lakes/metadata.json # https://example.org/ne_110m_lakes.json
      options:
          metadata_format: raw # default | tilejson
          bounds: [-7.733181,49.863063,1.763249,60.860926]
          zoom:
              min: 0
              max: 5
          schemes:
              - WebMercatorQuad
              - WorldCRS84Quad
      format:
          name: pbf
          mimetype: application/vnd.mapbox-vector-tile

KoalaGeo avatar Nov 24 '21 00:11 KoalaGeo

WIP PR: https://github.com/geopython/pygeoapi/pull/821

KoalaGeo avatar Nov 24 '21 00:11 KoalaGeo

@KoalaGeo We could have different data providers:

  • Mapbox tiles
  • PG-tile serv
  • ES

If we detach the metadata from the data, you could request the tile metadata, for instance in one of these formats:

  • tilejson
  • OGC 2TMS
  • None

In your case, the pg_tileserv data provider would pass a (metadata) path to the metadata provider and you could choose between one of those available.

I could prepare a PR to implement: 1 - different metadata providers (abstract class + derived classes) 3 - different mvt providers (abstract class + derived classes)

Does it make sense?

Reference: https://github.com/geopython/pygeoapi/issues/987

doublebyte1 avatar Oct 05 '22 07:10 doublebyte1

@doublebyte1 that sounds great to me!

KoalaGeo avatar Oct 05 '22 10:10 KoalaGeo

@KoalaGeo I am trying to update the vector tile backend to support a generic url. Do you have a pg_tileserv endpoint that I can use, to test this?

doublebyte1 avatar Nov 30 '22 08:11 doublebyte1

@KoalaGeo It is working now! https://github.com/geopython/pygeoapi/pull/1058

pg_tileserve

doublebyte1 avatar Dec 04 '22 12:12 doublebyte1

@KoalaGeo It is working now! #1058

pg_tileserve

Awesome!! great work!

KoalaGeo avatar Dec 05 '22 10:12 KoalaGeo

I found this issue happening again using pg_tileserv. It seems a regression. The issue happening here:

https://github.com/geopython/pygeoapi/blob/master/pygeoapi/provider/mvt.py#L257-L274

Where it enters the first block of the if is_url(self.data): even if I set service_metadata_url

Since service_metadata_url is optional and, I guess, present only when there is a specific need to use it, checking its presence before proceeding with the default "if" block could solve the issue. Do you think this makes sense? @doublebyte1

PascalLike avatar Oct 24 '23 10:10 PascalLike

As per RFC4, this Issue has been inactive for 90 days. In order to manage maintenance burden, it will be automatically closed in 7 days.

github-actions[bot] avatar Mar 10 '24 21:03 github-actions[bot]

As per RFC4, this Issue has been closed due to there being no activity for more than 90 days.

github-actions[bot] avatar Mar 24 '24 03:03 github-actions[bot]

@PascalLike @KoalaGeo As the metadata backend and the support to pg_tileserv was completely refactored, could you check if this issue was solved? If not, feel free to reopen it.

https://docs.pygeoapi.io/en/stable/data-publishing/ogcapi-tiles.html#mvt-proxy

doublebyte1 avatar Mar 26 '24 14:03 doublebyte1