You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
.. note:: The United States Geological Survey has created a Cookiecutter project for creating pygeoapi plugins. See the `pygeoapi-plugin-cookiecutter`_ project to get started.
67
+
68
+
**Option 2**: Update in core pygeoapi:
69
+
70
+
* Copy your plugin code into the pygeoapi source code directory - for example, if it is a provider plugin, copy it
71
+
to ``pygeoapi/provider``
72
+
* Update the plugin registry in ``pygeoapi/plugin.py:PLUGINS['provider']`` with the plugin's
73
+
shortname (say ``MyCoolVectorData``) and dotted path to the class (i.e. ``pygeoapi.provider.mycoolvectordata.MyCoolVectorDataProvider``)
74
+
* Specify in your dataset provider configuration as follows:
75
+
76
+
.. code-block:: yaml
77
+
78
+
providers:
79
+
- type: feature
80
+
# name may also refer to a known core pygeopai plugin
81
+
name: MyCoolVectorData
82
+
data: /path/to/file
83
+
id_field: stn_id
84
+
85
+
86
+
Customizing pygeoapi process manager
87
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
88
+
89
+
The pygeoapi process manager may also be customized. Similarly to the provider plugins, you may use the pygeoapi
90
+
configuration's ``server.manager.name`` to indicate either the dotted path to the python package and the relevant
91
+
manager class (*i.e.* similar to option 1 above) or the name of a known core pygeoapi plugin (*i.e.*, similar to
92
+
option 2 above).
93
+
94
+
95
+
96
+
97
+
98
+
41
99
Example: custom pygeoapi vector data provider
42
100
---------------------------------------------
43
101
@@ -109,46 +167,6 @@ Each base class documents the functions, arguments and return types required for
109
167
.. note:: You can add language support to your plugin using :ref:`these guides<language>`.
110
168
111
169
112
-
Connecting to pygeoapi
113
-
^^^^^^^^^^^^^^^^^^^^^^
114
-
115
-
The following methods are options to connect the plugin to pygeoapi:
116
-
117
-
**Option 1**: Update in core pygeoapi:
118
-
119
-
* copy ``mycoolvectordata.py`` into ``pygeoapi/provider``
120
-
* update the plugin registry in ``pygeoapi/plugin.py:PLUGINS['provider']`` with the plugin's
121
-
shortname (say ``MyCoolVectorData``) and dotted path to the class (i.e. ``pygeoapi.provider.mycoolvectordata.MyCoolVectorDataProvider``)
122
-
* specify in your dataset provider configuration as follows:
123
-
124
-
.. code-block:: yaml
125
-
126
-
providers:
127
-
- type: feature
128
-
name: MyCoolVectorData
129
-
data: /path/to/file
130
-
id_field: stn_id
131
-
132
-
133
-
**Option 2**: implement outside of pygeoapi and add to configuration (recommended)
134
-
135
-
* create a Python package of the ``mycoolvectordata.py`` module (see `Cookiecutter`_ as an example)
136
-
* install your Python package onto your system (``python3 setup.py install``). At this point your new package
137
-
should be in the ``PYTHONPATH`` of your pygeoapi installation
138
-
* specify in your dataset provider configuration as follows:
.. note:: The United States Geological Survey has created a Cookiecutter project for creating pygeoapi plugins. See the `pygeoapi-plugin-cookiecutter`_ project to get started.
0 commit comments