Custom Formatter plugin issues
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 https://github.com/geopython/pygeoapi/blob/a90f545978028f029331c115f90e8dc5d93c1239/pygeoapi/api/itemtypes.py#L650-L652
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.
I have the same problem, I am creating a custom provider :
example ->
providers:
- type: feature
name: pygeoapi.pygeoapi_complementos.Vector_provider.OGR_DataProvider.OGR_DataProvider
data: https://......zip
# id_field: id
# title_field: id
and a custom output format, defined in the same level as server, metadata, logging,...:
example ->
format:
topojson:
mimetype: application/topo+json
name: pygeoapi.pygeoapi_complementos.Vector_format.topojson_DataFormat.TopoJSON_DataFormatter
title: TopoJSON
and I can't register it from the configuration yml
This Issue has been inactive for 90 days. As per RFC4, in order to manage maintenance burden, it will be automatically closed in 7 days.
I've started work on a branch (with focus on item types), and will put forth a PR in the next few weeks once ready.