### Install and Run pygeoapi for CITE Testing Source: https://github.com/geopython/pygeoapi/blob/master/tests/cite/README.md Installs pygeoapi and its dependencies, configures the service for testing, generates OpenAPI specifications, and starts the pygeoapi server using gunicorn. Ensure HTTP 1.1 support is enabled. ```bash # install pygeoapi as per https://pygeoapi.io/#install-in-5-minutes # the service needs to run with HTTP 1.1 support, so let's install gunicorn # remove job manager rm -f /tmp/pygeoapi-process-manager.db* pip3 install gunicorn cd tests/cite . cite.env pygeoapi openapi generate $PYGEOAPI_CONFIG --output-file $PYGEOAPI_OPENAPI gunicorn pygeoapi.flask_app:APP -b 0.0.0.0:5001 --access-logfile '-' ``` -------------------------------- ### Install pygeoapi using pip Source: https://github.com/geopython/pygeoapi/blob/master/docs/source/installation.md Install the pygeoapi package using pip for a quick setup. ```bash pip3 install pygeoapi ``` -------------------------------- ### Install pygeoapi from Source Source: https://github.com/geopython/pygeoapi/blob/master/docs/source/installation.md Install pygeoapi from source for development or immediate use. This includes setting up a virtual environment, cloning the repository, installing dependencies, and configuring environment variables. ```bash python3 -m venv pygeoapi cd pygeoapi . bin/activate git clone https://github.com/geopython/pygeoapi.git cd pygeoapi pip3 install --upgrade pip pip3 install -r requirements.txt pip3 install . cp pygeoapi-config.yml example-config.yml vi example-config.yml # edit as required export PYGEOAPI_CONFIG=example-config.yml export PYGEOAPI_OPENAPI=example-openapi.yml pygeoapi openapi generate $PYGEOAPI_CONFIG --output-file $PYGEOAPI_OPENAPI pygeoapi serve curl http://localhost:5000 ``` -------------------------------- ### Install Documentation Dependencies Source: https://github.com/geopython/pygeoapi/blob/master/docs/source/development.md Install the necessary Python packages for building the documentation using pip. ```bash pip3 install -r docs/requirements.txt ``` -------------------------------- ### Configure HelloWorld Process Source: https://github.com/geopython/pygeoapi/blob/master/docs/source/publishing/ogcapi-processes.md Configuration for the 'HelloWorld' process, a simple example demonstrating process input and output. ```yaml hello-world: type: process processor: name: HelloWorld ``` -------------------------------- ### Install Spatialite Tools Source: https://github.com/geopython/pygeoapi/blob/master/docs/source/development.md Update Homebrew and install the spatialite-tools package, which includes the libspatialite library. ```bash brew update brew install spatialite-tools brew libspatialite ``` -------------------------------- ### Describe 'hello-world' Process with cURL Source: https://github.com/geopython/pygeoapi/blob/master/docs/source/publishing/ogcapi-processes.md Use cURL to get a detailed description of the 'hello-world' process. ```sh curl http://localhost:5000/processes/hello-world ``` -------------------------------- ### Install Docker and pygeoapi on Ubuntu Source: https://github.com/geopython/pygeoapi/blob/master/docker/README.md Installs Docker and pulls the official pygeoapi image. Requires manual creation and editing of a configuration file. ```bash # install Docker sudo apt-get install -y apt-transport-https sudo apt-get install -y ca-certificates sudo apt-get install -y curl sudo apt-get install -y gnupg-agent sudo apt-get install -y software-properties-common curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add – sudo apt-key fingerprint 0EBFCD88 sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" sudo apt-get update sudo apt-get install -y docker-ce docker-ce-cli containerd.io sudo systemctl enable docker # pull official pygeoapi image from Docker Hub docker pull geopython/pygeoapi # Create your own configuration in $HOME/my.config.yml # Example can be found in https://github.com/geopython/pygeoapi-examples/blob/main/docker/simple/my.config.yml vi $HOME/my.config.yml # run and create container sudo docker run --name pygeoapi -p 5000:80 -v $(pwd)/my.config.yml:/pygeoapi/local.config.yml -it geopython/pygeoapi ``` -------------------------------- ### Install Gunicorn Source: https://github.com/geopython/pygeoapi/blob/master/docs/source/running.md Install the Gunicorn WSGI HTTP server using pip. ```bash pip3 install gunicorn ``` -------------------------------- ### Install Django Dependencies Source: https://github.com/geopython/pygeoapi/blob/master/docs/source/running.md Install the necessary dependencies for pygeoapi to run with Django. ```bash pip3 install -r requirements-django.txt ``` -------------------------------- ### Kafka Broker Configuration Source: https://github.com/geopython/pygeoapi/blob/master/docs/source/pubsub.md Example configuration for setting up a Kafka broker. Includes options for authentication mechanisms if needed. ```yaml pubsub: name: Kafka broker: url: tcp://localhost:9092 channel: messages-a-data # if using authentication: # sasl_mechanism: PLAIN # default PLAIN # sasl_security_protocol: SASL_PLAINTEXT # default SASL_PLAINTEXT hidden: true # default false ``` -------------------------------- ### Install pygeoapi on FreeBSD using pkg Source: https://github.com/geopython/pygeoapi/blob/master/docs/source/installation.md Install the pygeoapi package on FreeBSD systems using the pkg package manager. ```bash pkg install py-pygeoapi ``` -------------------------------- ### BETWEEN Query using HTTP GET with CQL2 Text Source: https://github.com/geopython/pygeoapi/blob/master/docs/source/cql2.md This example demonstrates how to perform a 'BETWEEN' query using an HTTP GET request, with the query formatted as URL-encoded CQL2 text. ```bash curl "http://localhost:5000/collections/recentearthquakes/items?f=json&limit=10&filter=ml%20BETWEEN%204%20AND%204.5" ``` -------------------------------- ### Install pygeoapi on Ubuntu using apt Source: https://github.com/geopython/pygeoapi/blob/master/docs/source/installation.md Install the pygeoapi package on Ubuntu systems using the apt package manager from the UbuntuGIS repository. ```bash apt-get install python3-pygeoapi ``` -------------------------------- ### MQTT Broker Configuration Source: https://github.com/geopython/pygeoapi/blob/master/docs/source/pubsub.md Example configuration for setting up an MQTT broker within pygeoapi. Ensure the 'url' points to your MQTT broker. ```yaml pubsub: name: MQTT broker: url: mqtt://localhost:1883 channel: messages/a/data # optional hidden: false # default ``` -------------------------------- ### Install Development Dependencies Source: https://github.com/geopython/pygeoapi/blob/master/docs/source/running.md Installs development dependencies required for running pygeoapi locally. Ensure you have pip3 installed. ```bash pip3 install -r requirements-dev.txt ``` -------------------------------- ### Install pre-commit Hooks Source: https://github.com/geopython/pygeoapi/blob/master/docs/source/development.md Install the git commit hooks for pre-commit to enforce linting and static analysis before committing changes. This command should be run once. ```bash pre-commit install ``` -------------------------------- ### WET Implementation Example with Datetime Comparison Source: https://github.com/geopython/pygeoapi/wiki/Code-development-workflow An example of WET (Write Everything Twice) implementation, showing a direct comparison of datetime objects without leveraging more advanced libraries like pendulum, due to dependency limitations. ```python if te['begin'] is not None and datetime_begin != '..': if datetime_begin < te['begin']: datetime_invalid = True ``` -------------------------------- ### Install Starlette Dependencies Source: https://github.com/geopython/pygeoapi/blob/master/docs/source/running.md Installs the necessary dependencies for running pygeoapi with the Starlette ASGI server. This command should be run before serving with Starlette. ```bash pip3 install -r requirements-starlette.txt ``` -------------------------------- ### Run pygeoapi with Default Configuration Source: https://github.com/geopython/pygeoapi/blob/master/docs/source/docker.md Starts a pygeoapi Docker container using the default configuration and data. Access the service at http://localhost:5000. ```bash docker run -p 5000:80 -it geopython/pygeoapi run ``` ```bash docker run -p 5000:80 -it geopython/pygeoapi ``` -------------------------------- ### Install Python with SQLite Extensions Source: https://github.com/geopython/pygeoapi/blob/master/docs/source/development.md Install Python 3.12.3 using pyenv, enabling loadable SQLite extensions and configuring paths for SQLite and zlib libraries. ```bash LDFLAGS="-L/usr/local/opt/sqlite/lib -L/usr/local/opt/zlib/lib" CPPFLAGS="-I/usr/local/opt/sqlite/include -I/usr/local/opt/zlib/include" PYTHON_CONFIGURE_OPTS="--enable-loadable-sqlite-extensions" pyenv install 3.12.3 ``` -------------------------------- ### Example of Dynamic Link Update Source: https://github.com/geopython/pygeoapi/blob/master/docs/source/configuration.md Illustrates how pygeoapi updates MIME type and adds Content-Length to an enclosure link based on the actual resource. This is an example of the output format. ```json { "links": { "type": "application/zip", "rel": "enclosure", "title": "download link", "href": "https://myserver.com/data/file.zip", "length": 46435 } } ``` -------------------------------- ### Run pygeoapi with Django Source: https://github.com/geopython/pygeoapi/blob/master/docs/source/running.md Command to start the pygeoapi application using the Django web server. ```bash pygeoapi serve --django ``` -------------------------------- ### Configure Custom Python Process Source: https://github.com/geopython/pygeoapi/blob/master/docs/source/publishing/ogcapi-processes.md Example configuration for a custom Python process. The 'name' field should reference the Python class path. ```yaml my-process: type: process processor: # refer to a process in the standard PYTHONPATH # e.g. my_package/my_module/my_file.py (class MyProcess) # the MyProcess class must subclass from pygeoapi.process.base.BaseProcessor name: my_package.my_module.my_file.MyProcess ``` -------------------------------- ### pygeoapi Documentation Link Source: https://github.com/geopython/pygeoapi/wiki/Meeting-2020-04-13 This is the URL for the latest pygeoapi documentation. Check the 'Connection Examples' section for potential issues. ```text https://docs.pygeoapi.io/en/latest/data-publishing/ogcapi-features.html#connection-examples ``` -------------------------------- ### Python Package Description Example Source: https://github.com/geopython/pygeoapi/wiki/Code-development-workflow Basic description for a Python package's __init__.py file. This provides a high-level overview of the package's purpose. ```python """OGC process package, each process is an independent module""" ``` -------------------------------- ### SQLiteGPKG Provider with SQLite File Source: https://github.com/geopython/pygeoapi/blob/master/docs/source/publishing/ogcapi-features.md Configure a SQLiteGPKG provider using a path to a local SQLite database file. Requires Spatialite installation. ```yaml providers: - type: feature name: SQLiteGPKG data: ./tests/data/ne_110m_admin_0_countries.sqlite id_field: ogc_fid table: ne_110m_admin_0_countries ``` -------------------------------- ### Parameter Synchronization Setup Source: https://github.com/geopython/pygeoapi/blob/master/pygeoapi/templates/collections/edr/query.html Sets up a parameter synchronization object for managing synchronized parameters across different layers, such as palette and palette extent. ```javascript let paramSync = new C.ParameterSync({ syncProperties: { palette: (p1, p2) => p1, paletteExtent: (e1, e2) => e1 && e2 ? [Math.min(e1[0], e2[0]), Math.max(e1[1], e2[1])] : null } }).on('parameterAdd', e => { // The virtual sync layer proxies the synced palette, paletteExtent, and parameter. // The sync layer will fire a 'remove' event if all real layers for that parameter were removed. let layer = e.syncLayer if (layer.palette) { C.legend(layer, { position: 'bottomright' }).addTo(map) } }) ``` -------------------------------- ### pygeoapi Configuration Snippet Source: https://github.com/geopython/pygeoapi/blob/master/docs/source/configuration.md Example configuration block for pygeoapi, showing CRS, storage CRS, axis ordering, formatter definitions, and process configuration. ```yaml crs: - http://www.opengis.net/def/crs/EPSG/0/28992 - http://www.opengis.net/def/crs/OGC/1.3/CRS84 - http://www.opengis.net/def/crs/EPSG/0/4326 storage_crs: http://www.opengis.net/def/crs/OGC/1.3/CRS84 storage_crs_coordinate_epoch: 2017.23 always_xy: false formatters: - name: path.to.formatter attachment: true geom: false hello-world: type: process processor: name: HelloWorld allow_internal_requests: True ``` -------------------------------- ### Default Linked Data Context Example Source: https://github.com/geopython/pygeoapi/blob/master/docs/source/configuration.md Illustrates the expected data structure for aliasing properties using a non-existent vocabulary in the pygeoapi configuration. ```yaml linked-data: context: - datetime: https://schema.org/DateTime - vocab: https://example.com/vocab# stn_id: "vocab:stn_id" value: "vocab:value" ``` -------------------------------- ### Run pygeoapi with Starlette Source: https://github.com/geopython/pygeoapi/blob/master/docs/source/running.md Starts a pygeoapi server instance using Starlette as the ASGI implementation. This command explicitly tells pygeoapi to use Starlette. ```bash pygeoapi serve --starlette ``` -------------------------------- ### Build Documentation with Make Source: https://github.com/geopython/pygeoapi/blob/master/docs/source/development.md Alternatively, build the HTML documentation using the make command. This should be run from the root folder of the repository. ```bash make -C docs/ html ``` -------------------------------- ### Build and Upload Release Packages Source: https://github.com/geopython/pygeoapi/wiki/ReleaseManagement Build source distribution and wheel, then upload to PyPI. ```bash python3 setup.py sdist bdist_wheel --universal twine upload dist/* ``` -------------------------------- ### S_CROSSES Spatial Query using HTTP GET with CQL2 Text Source: https://github.com/geopython/pygeoapi/blob/master/docs/source/cql2.md This example shows how to perform a spatial query using the 'S_CROSSES' predicate via an HTTP GET request. The CQL2 text is passed directly in the 'filter' query parameter. ```bash curl "http://localhost:5000/collections/hot_osm_waterways/items?f=json&filter=S_CROSSES(foo_geom,%20LINESTRING(28%20-2,%2030%20-4))" ``` -------------------------------- ### Expose CLI Command via setup.py Entrypoint Source: https://github.com/geopython/pygeoapi/blob/master/docs/source/plugins.md Configure the 'pygeoapi' entry point in a plugin's setup.py file to expose custom CLI commands. ```python # file: setup.py entry_points={ 'pygeoapi': ['my-plugin = myplugin.cli:my_cli_command'] } ``` -------------------------------- ### OGC API Features Collections Endpoint Source: https://github.com/geopython/pygeoapi/wiki/Code-development-workflow This example shows the Python method signature corresponding to the OGC API Features 'GET /collections' endpoint. It follows the standard naming convention of VERB_OBJECT. ```python def describe_collections(self, headers_, format_, dataset=None): ``` -------------------------------- ### Python Docstring Example Source: https://github.com/geopython/pygeoapi/wiki/Code-development-workflow Example of a Python class with docstrings following reStructuredText syntax. ```APIDOC ## Class Definition with Docstrings ### Description Demonstrates the use of docstrings with reStructuredText syntax for documenting Python classes. ### Method N/A (Class definition) ### Endpoint N/A (Code example) ### Parameters N/A ### Request Example N/A ### Response N/A ```python class RasterioProvider(BaseProvider): """Rasterio Provider""" def __init__(self, provider_def): """ Initialize object :param provider_def: provider definition :returns: pygeoapi.provider.rasterio_.RasterioProvider """ ``` ``` -------------------------------- ### Execute 'hello-world' Job with Document Response Source: https://github.com/geopython/pygeoapi/blob/master/docs/source/publishing/ogcapi-processes.md Execute the 'hello-world' process and request a JSON document response by setting the 'response' parameter. ```sh curl -X POST http://localhost:5000/processes/hello-world/execution \ -H "Content-Type: application/json" \ -d "{\"inputs\":{\"name\": \"hi there2\"},\"response\":\"document\"}" ``` -------------------------------- ### Build Documentation with Sphinx Source: https://github.com/geopython/pygeoapi/blob/master/docs/source/development.md Build the HTML documentation using the sphinx-build command. Ensure you are in the root folder of the repository. ```bash sphinx-build -M html docs/source docs/build ``` -------------------------------- ### Install pygeoapi using Conda Source: https://github.com/geopython/pygeoapi/blob/master/docs/source/installation.md Install pygeoapi from the conda-forge channel using the conda package manager. ```bash conda install -c conda-forge pygeoapi ``` -------------------------------- ### Enable Hot-reloading with pip install -e Source: https://github.com/geopython/pygeoapi/blob/master/docs/source/running.md Install pygeoapi in editable mode to enable hot-reloading of code changes during development. ```bash pip3 install -e . ``` -------------------------------- ### Execute 'hello-world' Job with Success Subscriber Source: https://github.com/geopython/pygeoapi/blob/master/docs/source/publishing/ogcapi-processes.md Execute the 'hello-world' process and configure a success subscriber URI to receive notifications upon completion. ```sh curl -X POST http://localhost:5000/processes/hello-world/execution \ -H "Content-Type: application/json" \ -d "{\"inputs\":{\"name\": \"hi there2\"}, \ \"subscriber\": {\"successUri\": \"https://www.example.com/success\"}}" ``` -------------------------------- ### Serve Documentation Locally Source: https://github.com/geopython/pygeoapi/blob/master/docs/source/development.md Serve the generated HTML documentation locally using Python's http.server module. Navigate to http://localhost:8000 in your web browser. ```bash python3 -m http.server ``` -------------------------------- ### reStructuredText Table of Contents Example Source: https://github.com/geopython/pygeoapi/wiki/Code-development-workflow Example of a Table of Contents (TOC) definition in reStructuredText for Read the Docs. This file structures the documentation. ```rst .. _index: .. image:: /_static/pygeoapi-logo.png :scale: 50% :alt: pygeoapi logo pygeoapi |release| documentation ================================== :Author: the pygeoapi team :Contact: pygeoapi at lists.osgeo.org :Release: |release| :Date: |today| .. toctree:: :maxdepth: 4 :caption: Table of Contents :name: toc introduction how-pygeoapi-works ``` -------------------------------- ### Load TinyDB Records Example Source: https://github.com/geopython/pygeoapi/wiki/Meeting-2021-03-10 A sample metadata loader script that uses OWSLib to load ISO XML metadata into a TinyDB database. This is relevant for OGC API - Records implementation. ```python from owslib.etree import etree from tinydb import TinyDB, Table # Example usage: db = TinyDB('records.json') records = Table(db, 'records') # Load ISO XML metadata with open('metadata.xml', 'r') as f: records.insert({'id': '1', 'title': 'Example Record', 'abstract': 'This is an example record.', 'xml': f.read()}) print(records.all()) ``` -------------------------------- ### Execute 'hello-world' Job with JSON Input Source: https://github.com/geopython/pygeoapi/blob/master/docs/source/publishing/ogcapi-processes.md Execute the 'hello-world' process with a JSON payload specifying the 'name' input. ```sh curl -X POST http://localhost:5000/processes/hello-world/execution \ -H "Content-Type: application/json" \ -d "{\"inputs\":{\"name\": \"hi there2\"}}" ``` -------------------------------- ### Initialize New Language Translation Source: https://github.com/geopython/pygeoapi/blob/master/locale/README.md Use the `pybabel init` command to set up translation files for a new language. Specify the directory for translations, the language code, and the input POT file. ```bash pybabel init -d locale -l fr -i locale/messages.pot ``` -------------------------------- ### reStructuredText API Documentation Example Source: https://github.com/geopython/pygeoapi/wiki/Code-development-workflow Example of reStructuredText directives for generating API documentation from Python modules. Use 'automodule' to include members and inheritance. ```rst Provider -------- .. automodule:: pygeoapi.provider :show-inheritance: :members: :private-members: :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^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^```,{ ``` ```rst CSV provider ^^^^^^^^^^^^ .. automodule:: pygeoapi.provider.csv_ :show-inheritance: :members: :private-members: ``` -------------------------------- ### Execute 'hello-world' Job Asynchronously Source: https://github.com/geopython/pygeoapi/blob/master/docs/source/publishing/ogcapi-processes.md Execute the 'hello-world' process in asynchronous mode by including the 'Prefer: respond-async' header. The server will respond immediately with a job reference. ```sh curl -X POST http://localhost:5000/processes/hello-world/execution \ -H "Content-Type: application/json" \ -H "Prefer: respond-async" \ -d "{\"inputs\":{\"name\": \"hi there2\"}}" ``` -------------------------------- ### Python Class Docstring Example Source: https://github.com/geopython/pygeoapi/wiki/Code-development-workflow Example of a Python class docstring using reStructuredText syntax for method documentation. Ensure all methods and classes are documented. ```python class RasterioProvider(BaseProvider): """Rasterio Provider""" def __init__(self, provider_def): """ Initialize object :param provider_def: provider definition :returns: pygeoapi.provider.rasterio_.RasterioProvider """ ``` -------------------------------- ### Serve Documentation Locally on a Different Port Source: https://github.com/geopython/pygeoapi/blob/master/docs/source/development.md Serve the generated HTML documentation locally on a different port, such as 8001. Navigate to http://localhost:8001 in your web browser. ```bash python3 -m http.server 8001 ``` -------------------------------- ### Content-Crs HTTP Header Example Source: https://github.com/geopython/pygeoapi/blob/master/docs/source/crs.md This example demonstrates the Content-Crs HTTP header, which specifies the CRS for returned Feature coordinates according to the OGC API - Features standard. ```http Content-Crs: . ``` -------------------------------- ### Example Collection CRS Metadata Source: https://github.com/geopython/pygeoapi/blob/master/docs/source/crs.md This metadata shows the supported CRSs for a collection and its storage CRS. ```json { . . "crs": [ "http://www.opengis.net/def/crs/EPSG/0/4326", "http://www.opengis.net/def/crs/EPSG/0/3857", "http://www.opengis.net/def/crs/EPSG/0/28992", "http://www.opengis.net/def/crs/OGC/1.3/CRS84" ], "storageCrs": "http://www.opengis.net/def/crs/OGC/1.3/CRS84" } ``` -------------------------------- ### reStructuredText for Package Description Source: https://github.com/geopython/pygeoapi/wiki/Code-development-workflow Example of a reStructuredText string used in an __init__.py file for package description. ```APIDOC ## Package Initialization Docstring ### Description Example of a basic description for a Python package using reStructuredText in its `__init__.py` file. ### Method N/A (File content) ### Endpoint N/A (Code example) ### Parameters N/A ### Request Example N/A ### Response N/A ```rst """OGC process package, each process is an independent module""" ``` ``` -------------------------------- ### Run pygeoapi Docker container with default configuration Source: https://github.com/geopython/pygeoapi/blob/master/docker/README.md Starts a pygeoapi Docker container using the default configuration and data. Access the service at http://localhost:5000. ```bash docker run -p 5000:80 -it geopython/pygeoapi run # or simply docker run -p 5000:80 -it geopython/pygeoapi # then browse to http://localhost:5000 ``` -------------------------------- ### Run pygeoapi with Gunicorn and Flask Source: https://github.com/geopython/pygeoapi/blob/master/docs/source/running.md Command to start the pygeoapi application using Gunicorn with the Flask application. ```bash gunicorn pygeoapi.flask_app:APP ``` -------------------------------- ### Update Demo Server Configuration Source: https://github.com/geopython/pygeoapi/wiki/ReleaseManagement Update the Docker Compose file and local configuration for the demo server. ```bash edit/commit/push `services/pygeoapi_stable/docker-compose.yml`: set new version tag `x.y.z` of `image: geopython/pygeoapi: x.y.z` edit/commit/push `services/pygeoapi_stable/local.config.yml`: set new version in `metadata.identification.title` ``` -------------------------------- ### Create Stable Branch and Pin Requirements Source: https://github.com/geopython/pygeoapi/wiki/ReleaseManagement Create a stable branch and pin requirements for it. ```bash git checkout -b x.y vi requirements.txt # pin requirements in requirements.txt as per RFC2 git commit -m 'pin requirements to stable branch' requirements.txt git push x.y ``` -------------------------------- ### Run pygeoapi with Hot Reload Source: https://github.com/geopython/pygeoapi/blob/master/docs/source/docker.md Starts a pygeoapi Docker container with hot-reloading of the configuration enabled. This is useful during development. ```bash docker run -p 5000:80 -it geopython/pygeoapi run-with-hot-reload ``` -------------------------------- ### Read the Docs Table of Contents (index.rst) Source: https://github.com/geopython/pygeoapi/wiki/Code-development-workflow Example of the `index.rst` file structure for Read the Docs, defining the Table of Contents. ```APIDOC ## Read the Docs Table of Contents Configuration ### Description Illustrates the structure of an `index.rst` file used by Read the Docs to define the project's Table of Contents (TOC). ### Method N/A (Configuration file content) ### Endpoint N/A (Configuration file example) ### Parameters N/A ### Request Example N/A ### Response N/A ```rst .. _index: .. image:: /_static/pygeoapi-logo.png :scale: 50% :alt: pygeoapi logo pygeoapi |release| documentation ================================== :Author: the pygeoapi team :Contact: pygeoapi at lists.osgeo.org :Release: |release| :Date: |today| .. toctree:: :maxdepth: 4 :caption: Table of Contents :name: toc introduction how-pygeoapi-works ``` ``` -------------------------------- ### Restart Demo Server Services Source: https://github.com/geopython/pygeoapi/wiki/ReleaseManagement Stop and restart the pygeoapi services on the demo server. ```bash cd ~/git/services/pygeoapi_stable ./stop.sh then ./start.sh ```