-
-
Notifications
You must be signed in to change notification settings - Fork 295
Description
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:
- Produce custom formatter plugin
- Add plugin to
pygeoapi.plugins.PLUGINS.formatters
- Query using custom format
- 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
Furthermore the only formatter plugin in core, CSV is hardcoded
pygeoapi/pygeoapi/api/itemtypes.py
Lines 650 to 652 in a90f545
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.