Skip to main content

Running pygeoapi locally

Before geoconnex can leverage your data, it must be exposed in a way that geoconnex can crawl it.

pygeoapi is a standardized, low-barrier, and open-source geospatial web server which allows you to output your data in a format that can be ingested by geoconnex. It leverages the OGC-API Features standard, which gives each individual feature within a geospatial vector dataset a unique URL with an associated HTML landing page, a GeoJSON response, and a JSON-LD response.

info

In this tutorial, we use our fork of pygeoapi from the internetofwater/pygeoapi repository which provides support for additional data provider backends. It is recommended that you use this same fork.

Running with Docker

Our fork of pygeoapi is most easily deployed with Docker to ensure reproducibility. You can also clone the repo and install from source in a similar way to upstream pygeoapi, but this may take additional effort.

Using Docker, you can spin up pygeoapi with one command. Once you have pygeoapi running, you can navigate to http://localhost:5000 to explore the frontend.

docker run -p 5000:80 -it --rm internetofwater/pygeoapi

Running with a custom configuration

Once you have explored the baseline configuration you can use git clone and deploy a custom pygeoapi instance. To do this:

  1. Clone the repository
    • (We clone the repository only to get a copy of the config file; assuming you are using Docker, you do not need to worry about source code or other files for setting up the environment)
  2. Copy the default config named pygeoapi-config.yml and name it local.config.yml
  3. Change the settings in local.config.yml to fit your needs
    • local.config.yml is your local config that will specify which extra resources you want to expose and how you want them to be templated.
    • See the pygeoapi docs for a list of all configuration options.
  4. Run the container with a custom config.
git clone https://github.com/internetofwater/pygeoapi
cd pygeoapi
docker run -p 5000:80 -v $(pwd)/local.config.yml:/pygeoapi/local.config.yml -it --rm internetofwater/pygeoapi:latest
tip

If you wish to use docker-compose, view the pygeoapi-geoconnex-examples repo for sample configuration

Next steps

Once you have set up the container locally and explored the frontend, you can begin to start ingesting your data