Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
63 lines (35 sloc) 1.57 KB

Plugins

In this section we will explain how pygeoapi uses a plugin approach for data providers, formatters and processes.

Plugin data provider plugin

Plugins are in general modules containing derived classed classes that ensure minimal requirements for the plugin to work. Lets consider the steps for a data provider plugin (source code is located here: :ref:`data Provider`)

  1. create a new module file on the provider folder (e.g myprovider.py)

  2. copy code from base.py

  3. import base provider class

    from pygeoapi.provider.base import BaseProvider
  4. create a child class from the BaseProvider class with a specific name

    class BaseProvider(object):
        """generic Provider ABC"""
    
        def __init__(self, provider_def):
            """
            Initialize object

    to become:

    class MyDataProvider(object):
        """My data provider"""
    
       def __init__(self, provider_def):
         """Inherit from parent class"""
         BaseProvider.__init__(self, provider_def)
  5. implement class methods.

    def query(self):
    
    def get(self, identifier):
    
    def create(self, new_feature):
    
    def update(self, identifier, new_feature):
    
    def delete(self, identifier):

The above class methods are related to the specific URLs defined on the OGC openapi specification:

You can’t perform that action at this time.