Skip to content

Custom Formatter plugin issues #1997

@webb-ben

Description

@webb-ben

Description
The Formatter Plugin architecture does not appear to be fully integrated. Following the documentation in https://docs.pygeoapi.io/en/latest/plugins.html#example-custom-pygeoapi-formatter, but there is no way for me to use the formatter plugin as an output in pygeoapi.

Steps to Reproduce
Steps to reproduce the behavior:

  1. Produce custom formatter plugin
  2. Add plugin to pygeoapi.plugins.PLUGINS.formatters
  3. Query using custom format
  4. Results are JSON.

Expected behavior
I would expect for there to be a clear way to deploy a custom formatter plugin in pygeoapi. I would expect appropriately registered formatters to be loaded consistent with pygeaopi's plugin architecture.

Screenshots/Tracebacks
Unlike the provider, the formatters are never specified in the configuration to load an external plugin. It appears the formatters are only ever validated to ensure against the keys in pygeoapi.plugins.PLUGINS.formatters, see https://github.com/search?q=repo:geopython/pygeoapi+PLUGINS['formatter']&type=code

Image

Furthermore the only formatter plugin in core, CSV is hardcoded

elif request.format == 'csv': # render
formatter = load_plugin('formatter',
{'name': 'CSV', 'geom': True})

Environment

  • OS: All
  • Python version: 3.10
  • pygeoapi version: 0.21.dev0

Additional context
It seems a large portion of the formatting can be also done in a Jinja2 template. I think it would benefit pygeoapi to have a clearer picture of how the different ways to format outputs between the Formatter architecture and Jinja2 templates.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions