Alexandre Leroux 02ee73a8f4 typo (#79)
2 minor typos
2019-01-17 13:22:29 -05:00
2019-01-07 12:22:18 +00:00
2018-11-24 13:23:06 +01:00
2019-01-15 01:46:29 +00:00
2018-11-26 20:47:45 -05:00
2018-11-16 11:53:31 -05:00
2018-02-14 21:46:28 -05:00
2018-11-26 19:50:17 -05:00
2018-04-02 18:18:37 -04:00
2019-01-17 13:22:29 -05:00
2018-03-05 02:51:40 +00:00

pygeoapi

Build Status

pygeoapi provides an API to geospatial data

Installation

virtualenv -p python pygeoapi
cd pygeoapi
. bin/activate
git clone https://github.com/geopython/pygeoapi.git
cd pygeoapi
pip install -r requirements.txt
pip install -r requirements-dev.txt
pip install -e .
cp pygeoapi-config.yml local.config.yml
vi local.config.yml
# TODO: what is most important to edit?
export PYGEOAPI_CONFIG=/path/to/local.config.yml
# generate OpenAPI Document
pygeoapi generate-openapi-document -c local.config.yml > openapi.yml
export PYGEOAPI_OPENAPI=/path/to/openapi.yml
pygeoapi serve

Example requests

Try the swagger ui at http://localhost:5000/ui

or

# feature collection metadata
curl http://localhost:5000/
# conformance
curl http://localhost:5000/conformance
# feature collection
curl http://localhost:5000/collections/countries
# feature collection limit 100
curl http://localhost:5000/collections/countries/items?limit=100
# feature
curl http://localhost:5000/collections/countries/items/1
# number of hits
curl http://localhost:5000/collections/countries/items?resulttype=hits

Exploring with Swagger UI

docker pull swaggerapi/swagger-ui
docker run -p 80:8080 swaggerapi/swagger-ui
# go to http://localhost
# enter http://localhost:5000/api and click 'Explore'

Docker

Docker folder contains 2 sub-folders:

  • Simple
  • Compose

First folder will create a simple docker image with only GeoJSON, CSV as SQLite providers. While the second folder contains a full docker composition to run pygeoapi with ES.

For simple testing and demonstration is more convenient to use the simple image.

Docker images have the following settings:

  • Alpine edge OS
  • spatialite compilation 4.3.0a
  • pygeoapi running on port 5000

Simple (image)

Simple sub folder contains a simple implementation of pygeoapi with out ES (only: GeoJSON, CSV and SQLite provider).

cd docker/simple
docker build -t pygeoapi:latest .
docker run -p5000:5000 -v /pygeoapi/tests/data pygeoapi:latest

Docker (composition)

Docker folder contains a docker-composition necessary to build a minimal pygeoapi using the complete set of providers providers (ES needs to be run as a separated service). Composition is only for development and testing in local environment:

ES

  • official elasticsearch: 5.6.8 on CentosOS 7
  • ports 9300 and 9200

Elasticsearch requires the host system to have its virtual memory parameter (max_map_count) here

sudo sysctl -w vm.max_map_count=262144

If the docker composition fails with the following error:

docker_elastic_search_1 exited with code 78

it is very likely that you forgot to setup the sysctl

Building and Running composition:

To build and run the composition in localhost

cd docker/compose
sudo sysctl -w vm.max_map_count=262144
docker-compose build
docker-compose up 

Testing code

Unit tests are run using pytest on the top project folder:

pytest tests

Environment variables are set on file pytest.ini

S
Description
pygeoapi is a Python server implementation of the OGC API suite of standards. The project emerged as part of the next generation OGC API efforts in 2018 and provides the capability for organizations to deploy a RESTful OGC API endpoint using OpenAPI, GeoJSON, and HTML. pygeoapi is open source and released under an MIT license.
Readme 50 MiB
Languages
nesC 76.3%
Python 22.3%
HTML 1.3%