Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 64 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,67 @@
[pygeoapi](https://pygeoapi.io) is a Python server implementation of the [OGC API](https://ogcapi.ogc.org) 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](https://opensource.org/) and released under an [MIT license](https://github.com/geopython/pygeoapi/blob/master/LICENSE.md).

Please read the docs at [https://docs.pygeoapi.io](https://docs.pygeoapi.io) for more information.



## AquaInfra case

Please add these steps when installing pygeoapi for the AquaInfra case, as they are needed to run the `get_species_data` process!

* Please install the python module `geojson` in the virtual environment that runs the service (most likely running `cd /home/.../pygeoapi/pygeoapi && . ../bin/activate && pip install geojson` will do the job).
* Please create a directory for the input data, e.g. `/home/.../work/pygeo/data`
* Into that directory, add a directory `basin_481051` and into that, put the input vector file `basin_481051.gpkg`. The same for any other river basin you want to support (`481051` being the drainage basin id).
* Then, tell pygeoapi where to find the data, by executing: `export PYGEOAPI_DATA_DIR='/home/.../work/pygeo/data'`.
* Please install the R library `rgbif`.

(Merret, 2023-10-18)


### Creating basin_481051.gpkg

You can create this file using R and the package [hydrographr](https://github.com/glowabio/hydrographr/) with the following steps. The source of the data is [hydrography90m](https://hydrography.org/).

```
library(hydrographr)

### Merret, 2023-10-17
### To allow downloading and creating the vector layer needed for the pygeoapi
### test service "get_species_data": basin_481051.gpkg
### Instructions are a subset of:
### https://glowabio.github.io/hydrographr/articles/case_study_brazil.html

### Download three tiles that comprise basin 481051
wdir = "/home/.../work/"
tile_id = c("h12v08", "h12v10", "h14v08")
vars_gpkg <- c("basin", "order_vect_segment")
download_tiles(variable = vars_gpkg, tile_id = tile_id, file_format = "gpkg", download_dir = paste0(wdir, "/data"))

### Filter basin 481051
# Define a directory for the São Francisco drainage basin
saofra_dir <- paste0(wdir, "/data/basin_481051")
if(!dir.exists(saofra_dir)) dir.create(saofra_dir)
# Get the full paths of the basin GeoPackage tiles
basin_dir <- list.files(wdir, pattern = "basin_h[v0-8]+.gpkg$", full.names = TRUE, recursive = TRUE)

# Filter basin ID from the GeoPackages of the basin tiles
# Save the filtered tiles
for(itile in basin_dir) {
filtered_tile <- read_geopackage(itile, import_as = "sf", subc_id = 481051, name = "ID")
write_sf(filtered_tile, paste(saofra_dir, paste0(str_remove(basename(itile), ".gpkg"),"_tmp.gpkg"), sep="/"))
}

### Merge basin 481051
# Merge filtered GeoPackage tiles
merge_tiles(tile_dir = saofra_dir, tile_names = list.files(saofra_dir, full.names = FALSE, pattern = "basin_.+_tmp.gpkg$"),
out_dir = saofra_dir,
file_name = "basin_481051.gpkg",
name = "ID",
read = FALSE)


```


(Merret, 2023-10-18)


241 changes: 17 additions & 224 deletions pygeoapi-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ server:
languages:
# First language is the default language
- en-US
- fr-CA
# cors: true
pretty_print: true
limit: 10
Expand All @@ -55,250 +54,44 @@ server:
# ogc_schemas_location: /opt/schemas.opengis.net

logging:
level: ERROR
level: DEBUG
#logfile: /tmp/pygeoapi.log

metadata:
identification:
title:
en: pygeoapi default instance
fr: instance par défaut de pygeoapi
en: AquaInfra processing services
description:
en: pygeoapi provides an API to geospatial data
fr: pygeoapi fournit une API aux données géospatiales
en: An OGC conformant API to AquaInfra processing services
keywords:
en:
- geospatial
- data
- api
fr:
- géospatiale
- données
- api
keywords_type: theme
terms_of_service: https://creativecommons.org/licenses/by/4.0/
url: https://example.org
license:
name: CC-BY 4.0 license
name: CC-BY 4.0 license (TODO check)
url: https://creativecommons.org/licenses/by/4.0/
provider:
name: Organization Name
url: https://pygeoapi.io
name: Leibniz Institute for Freshwater Ecology and Inland Fisheries (FVB-IGB), Berlin
url: https://igb-berlin.de
contact:
name: Lastname, Firstname
position: Position Title
address: Mailing Address
city: City
stateorprovince: Administrative Area
postalcode: Zip or Postal Code
country: Country
phone: +xx-xxx-xxx-xxxx
fax: +xx-xxx-xxx-xxxx
email: [email protected]
url: Contact URL
hours: Mo-Fr 08:00-17:00
instructions: During hours of service. Off on weekends.
name: Buurman, Merret
position: Scientific Staff
address: Müggelseedamm 310
city: Berlin
stateorprovince: Berlin
postalcode: 12587
country: Germany
email: [email protected]
url: https://glowabio.org/
role: pointOfContact

resources:
obs:
type: collection
title: Observations
description: My cool observations
keywords:
- observations
- monitoring
linked-data:
context:
- datetime: https://schema.org/DateTime
- vocab: https://example.com/vocab#
stn_id: "vocab:stn_id"
value: "vocab:value"
links:
- type: text/csv
rel: canonical
title: data
href: https://github.com/mapserver/mapserver/blob/branch-7-0/msautotest/wxs/data/obs.csv
hreflang: en-US
- type: text/csv
rel: alternate
title: data
href: https://raw.githubusercontent.com/mapserver/mapserver/branch-7-0/msautotest/wxs/data/obs.csv
hreflang: en-US
extents:
spatial:
bbox: [-180,-90,180,90]
crs: http://www.opengis.net/def/crs/OGC/1.3/CRS84
temporal:
begin: 2000-10-30T18:24:39Z
end: 2007-10-30T08:57:29Z
providers:
- type: feature
name: CSV
data: tests/data/obs.csv
id_field: id
geometry:
x_field: long
y_field: lat

lakes:
type: collection
title:
en: Large Lakes
fr: Grands Lacs
description:
en: lakes of the world, public domain
fr: lacs du monde, domaine public
keywords:
en:
- lakes
- water bodies
fr:
- lacs
- plans d'eau
links:
- type: text/html
rel: canonical
title: information
href: http://www.naturalearthdata.com/
hreflang: en-US
extents:
spatial:
bbox: [-180,-90,180,90]
crs: http://www.opengis.net/def/crs/OGC/1.3/CRS84
temporal:
begin: 2011-11-11T11:11:11Z
end: null # or empty (either means open ended)
providers:
- type: feature
name: GeoJSON
data: tests/data/ne_110m_lakes.geojson
id_field: id
title_field: name

mapserver_world_map:
type: collection
title: MapServer demo WMS world map
description: MapServer demo WMS world map
keywords:
- MapServer
- world map
links:
- type: text/html
rel: canonical
title: information
href: https://demo.mapserver.org
hreflang: en-US
extents:
spatial:
bbox: [-180,-90,180,90]
crs: http://www.opengis.net/def/crs/OGC/1.3/CRS84
providers:
- type: map
name: WMSFacade
data: https://demo.mapserver.org/cgi-bin/msautotest
options:
layer: world_latlong
style: default
format:
name: png
mimetype: image/png

gdps-temperature:
type: collection
title: Global Deterministic Prediction System sample
description: Global Deterministic Prediction System sample
keywords:
- gdps
- global
extents:
spatial:
bbox: [-180,-90,180,90]
crs: http://www.opengis.net/def/crs/OGC/1.3/CRS84
links:
- type: text/html
rel: canonical
title: information
href: https://eccc-msc.github.io/open-data/msc-data/nwp_gdps/readme_gdps_en
hreflang: en-CA
providers:
- type: coverage
name: rasterio
data: tests/data/CMC_glb_TMP_TGL_2_latlon.15x.15_2020081000_P000.grib2
options:
DATA_ENCODING: COMPLEX_PACKING
format:
name: GRIB
mimetype: application/x-grib2

test-data:
type: stac-collection
title: pygeoapi test data
description: pygeoapi test data
keywords:
- poi
- portugal
links:
- type: text/html
rel: canonical
title: information
href: https://github.com/geopython/pygeoapi/tree/master/tests/data
hreflang: en-US
extents:
spatial:
bbox: [-180,-90,180,90]
crs: http://www.opengis.net/def/crs/OGC/1.3/CRS84
providers:
- type: stac
name: FileSystem
data: tests/data
file_types:
- .gpkg
- .sqlite
- .csv
- .grib2
- .tif
- .shp

canada-metadata:
type: collection
title:
en: Open Canada sample data
fr: Exemple de donn\u00e9es Canada Ouvert
description:
en: Sample metadata records from open.canada.ca
fr: Exemples d'enregistrements de m\u00e9tadonn\u00e9es sur ouvert.canada.ca
keywords:
en:
- canada
- open data
fr:
- canada
- donn\u00e9es ouvertes
links:
- type: text/html
rel: canonical
title: information
href: https://open.canada.ca/en/open-data
hreflang: en-CA
- type: text/html
rel: alternate
title: informations
href: https://ouvert.canada.ca/fr/donnees-ouvertes
hreflang: fr-CA
extents:
spatial:
bbox: [-180,-90,180,90]
crs: http://www.opengis.net/def/crs/OGC/1.3/CRS84
providers:
- type: record
name: TinyDBCatalogue
data: tests/data/open.canada.ca/sample-records.tinydb
id_field: externalId
time_field: recordCreated
title_field: title

hello-world:
get-species-data:
type: process
processor:
name: HelloWorld
name: GetSpeciesData
3 changes: 2 additions & 1 deletion pygeoapi/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@
'CSV': 'pygeoapi.formatter.csv_.CSVFormatter'
},
'process': {
'HelloWorld': 'pygeoapi.process.hello_world.HelloWorldProcessor'
'HelloWorld': 'pygeoapi.process.hello_world.HelloWorldProcessor',
'GetSpeciesData': 'pygeoapi.process.get_species_data_pygeo.GetSpeciesData'
},
'process_manager': {
'Dummy': 'pygeoapi.process.manager.dummy.DummyManager',
Expand Down
Loading