Skip to content
Closed
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
75 changes: 16 additions & 59 deletions pygeoapi/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,15 @@
from shapely.wkt import loads as shapely_loads

from pygeoapi import __version__, l10n
from pygeoapi.api_ import get_conformance_classes
from pygeoapi.api_.common import conformance as conformance_common
from pygeoapi.api_.coverage import conformance as conformance_coverage
from pygeoapi.api_.edr import conformance as conformance_edr
from pygeoapi.api_.feature import conformance as conformance_feature
from pygeoapi.api_.map import conformance as conformance_map
from pygeoapi.api_.process import conformance as conformance_process
from pygeoapi.api_.record import conformance as conformance_record
from pygeoapi.api_.tile import conformance as conformance_tile
from pygeoapi.formatter.base import FormatterSerializationError
from pygeoapi.linked_data import (geojson2jsonld, jsonldify,
jsonldify_collection)
Expand Down Expand Up @@ -120,65 +129,13 @@
#: Locale used for system responses (e.g. exceptions)
SYSTEM_LOCALE = l10n.Locale('en', 'US')

CONFORMANCE = {
'common': [
'http://www.opengis.net/spec/ogcapi-common-1/1.0/conf/core',
'http://www.opengis.net/spec/ogcapi-common-2/1.0/conf/collections',
'http://www.opengis.net/spec/ogcapi-common-1/1.0/conf/landing-page',
'http://www.opengis.net/spec/ogcapi-common-1/1.0/conf/json',
'http://www.opengis.net/spec/ogcapi-common-1/1.0/conf/html',
'http://www.opengis.net/spec/ogcapi-common-1/1.0/conf/oas30'
],
'feature': [
'http://www.opengis.net/spec/ogcapi-features-1/1.0/conf/core',
'http://www.opengis.net/spec/ogcapi-features-1/1.0/req/oas30',
'http://www.opengis.net/spec/ogcapi-features-1/1.0/conf/html',
'http://www.opengis.net/spec/ogcapi-features-1/1.0/conf/geojson',
'http://www.opengis.net/spec/ogcapi-features-2/1.0/conf/crs',
'http://www.opengis.net/spec/ogcapi-features-3/1.0/conf/queryables',
'http://www.opengis.net/spec/ogcapi-features-3/1.0/conf/queryables-query-parameters', # noqa
'http://www.opengis.net/spec/ogcapi-features-4/1.0/conf/create-replace-delete', # noqa
'http://www.opengis.net/spec/ogcapi-features-5/1.0/conf/schemas',
'http://www.opengis.net/spec/ogcapi-features-5/1.0/req/core-roles-features' # noqa
],
'coverage': [
'http://www.opengis.net/spec/ogcapi-coverages-1/1.0/conf/core',
'http://www.opengis.net/spec/ogcapi-coverages-1/1.0/conf/oas30',
'http://www.opengis.net/spec/ogcapi-coverages-1/1.0/conf/html',
'http://www.opengis.net/spec/ogcapi-coverages-1/1.0/conf/geodata-coverage', # noqa
'http://www.opengis.net/spec/ogcapi-coverages-1/1.0/conf/coverage-subset', # noqa
'http://www.opengis.net/spec/ogcapi-coverages-1/1.0/conf/coverage-rangesubset', # noqa
'http://www.opengis.net/spec/ogcapi-coverages-1/1.0/conf/coverage-bbox', # noqa
'http://www.opengis.net/spec/ogcapi-coverages-1/1.0/conf/coverage-datetime' # noqa
],
'map': [
'http://www.opengis.net/spec/ogcapi-maps-1/1.0/conf/core'
],
'tile': [
'http://www.opengis.net/spec/ogcapi-tiles-1/1.0/conf/core',
'http://www.opengis.net/spec/ogcapi-tiles-1/1.0/conf/mvt',
'http://www.opengis.net/spec/ogcapi-tiles-1/1.0/conf/tileset',
'http://www.opengis.net/spec/ogcapi-tiles-1/1.0/conf/tilesets-list',
'http://www.opengis.net/spec/ogcapi-tiles-1/1.0/conf/oas30',
'http://www.opengis.net/spec/ogcapi-tiles-1/1.0/conf/geodata-tilesets'
],
'record': [
'http://www.opengis.net/spec/ogcapi-records-1/1.0/conf/core',
'http://www.opengis.net/spec/ogcapi-records-1/1.0/conf/sorting',
'http://www.opengis.net/spec/ogcapi-records-1/1.0/conf/opensearch',
'http://www.opengis.net/spec/ogcapi-records-1/1.0/conf/json',
'http://www.opengis.net/spec/ogcapi-records-1/1.0/conf/html'
],
'process': [
'http://www.opengis.net/spec/ogcapi-processes-1/1.0/conf/ogc-process-description', # noqa
'http://www.opengis.net/spec/ogcapi-processes-1/1.0/conf/core',
'http://www.opengis.net/spec/ogcapi-processes-1/1.0/conf/json',
'http://www.opengis.net/spec/ogcapi-processes-1/1.0/conf/oas30'
],
'edr': [
'http://www.opengis.net/spec/ogcapi-edr-1/1.0/conf/core'
]
}
CONFORMANCE = {}

for conformance in get_conformance_classes(
ogc_specs=[conformance_common, conformance_coverage, conformance_edr,
conformance_feature, conformance_map, conformance_process,
conformance_record, conformance_tile]):
CONFORMANCE.update(conformance.items())

OGC_RELTYPES_BASE = 'http://www.opengis.net/def/rel/ogc/1.0'

Expand Down
55 changes: 55 additions & 0 deletions pygeoapi/api_/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# =================================================================
#
# Authors: Tom Kralidis <tomkralidis@gmail.com>
# Francesco Bartoli <xbartolone@gmail.com>
# Sander Schaminee <sander.schaminee@geocat.net>
# John A Stevenson <jostev@bgs.ac.uk>
# Colin Blackburn <colb@bgs.ac.uk>
# Ricardo Garcia Silva <ricardo.garcia.silva@geobeyond.it>
#
# Copyright (c) 2024 Tom Kralidis
# Copyright (c) 2024 Francesco Bartoli
# Copyright (c) 2022 John A Stevenson and Colin Blackburn
# Copyright (c) 2023 Ricardo Garcia Silva
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
# files (the "Software"), to deal in the Software without
# restriction, including without limitation the rights to use,
# copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following
# conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
#
# =================================================================
""" Root level code of pygeoapi, passing content provided by web framework.
Returns content from plugins and sets responses for the specifications.
"""


from dataclasses import dataclass
from typing import Dict, List, Iterable


@dataclass
class ConformanceClasses:
name: str
classes: List[str]


def get_conformance_classes(ogc_specs: List[
ConformanceClasses]) -> Iterable[Dict[str, List[str]]]:
"""Get an iterable of OGC API conformance classes"""
return ({spec.name: spec.classes} for spec in ogc_specs)
54 changes: 54 additions & 0 deletions pygeoapi/api_/common.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# =================================================================
#
# Authors: Tom Kralidis <tomkralidis@gmail.com>
# Francesco Bartoli <xbartolone@gmail.com>
# Sander Schaminee <sander.schaminee@geocat.net>
# John A Stevenson <jostev@bgs.ac.uk>
# Colin Blackburn <colb@bgs.ac.uk>
# Ricardo Garcia Silva <ricardo.garcia.silva@geobeyond.it>
#
# Copyright (c) 2024 Tom Kralidis
# Copyright (c) 2024 Francesco Bartoli
# Copyright (c) 2022 John A Stevenson and Colin Blackburn
# Copyright (c) 2023 Ricardo Garcia Silva
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
# files (the "Software"), to deal in the Software without
# restriction, including without limitation the rights to use,
# copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following
# conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
#
# =================================================================
""" Module for API Common, passing content provided by web framework.
Returns content from plugins and sets responses for that specification.
"""


from pygeoapi.api_ import ConformanceClasses


conformance_classes = [
'http://www.opengis.net/spec/ogcapi-common-1/1.0/conf/core',
'http://www.opengis.net/spec/ogcapi-common-2/1.0/conf/collections',
'http://www.opengis.net/spec/ogcapi-common-1/1.0/conf/landing-page',
'http://www.opengis.net/spec/ogcapi-common-1/1.0/conf/json',
'http://www.opengis.net/spec/ogcapi-common-1/1.0/conf/html',
'http://www.opengis.net/spec/ogcapi-common-1/1.0/conf/oas30'
]

conformance = ConformanceClasses(name='common', classes=conformance_classes)
56 changes: 56 additions & 0 deletions pygeoapi/api_/coverage.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# =================================================================
#
# Authors: Tom Kralidis <tomkralidis@gmail.com>
# Francesco Bartoli <xbartolone@gmail.com>
# Sander Schaminee <sander.schaminee@geocat.net>
# John A Stevenson <jostev@bgs.ac.uk>
# Colin Blackburn <colb@bgs.ac.uk>
# Ricardo Garcia Silva <ricardo.garcia.silva@geobeyond.it>
#
# Copyright (c) 2024 Tom Kralidis
# Copyright (c) 2024 Francesco Bartoli
# Copyright (c) 2022 John A Stevenson and Colin Blackburn
# Copyright (c) 2023 Ricardo Garcia Silva
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
# files (the "Software"), to deal in the Software without
# restriction, including without limitation the rights to use,
# copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following
# conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
#
# =================================================================
""" Module for API Coverages, passing content provided by web framework.
Returns content from plugins and sets responses for that specification.
"""


from pygeoapi.api_ import ConformanceClasses


conformance_classes = [
'http://www.opengis.net/spec/ogcapi-coverages-1/1.0/conf/core',
'http://www.opengis.net/spec/ogcapi-coverages-1/1.0/conf/oas30',
'http://www.opengis.net/spec/ogcapi-coverages-1/1.0/conf/html',
'http://www.opengis.net/spec/ogcapi-coverages-1/1.0/conf/geodata-coverage', # noqa
'http://www.opengis.net/spec/ogcapi-coverages-1/1.0/conf/coverage-subset', # noqa
'http://www.opengis.net/spec/ogcapi-coverages-1/1.0/conf/coverage-rangesubset', # noqa
'http://www.opengis.net/spec/ogcapi-coverages-1/1.0/conf/coverage-bbox', # noqa
'http://www.opengis.net/spec/ogcapi-coverages-1/1.0/conf/coverage-datetime' # noqa
]

conformance = ConformanceClasses(name='coverage', classes=conformance_classes)
49 changes: 49 additions & 0 deletions pygeoapi/api_/edr.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# =================================================================
#
# Authors: Tom Kralidis <tomkralidis@gmail.com>
# Francesco Bartoli <xbartolone@gmail.com>
# Sander Schaminee <sander.schaminee@geocat.net>
# John A Stevenson <jostev@bgs.ac.uk>
# Colin Blackburn <colb@bgs.ac.uk>
# Ricardo Garcia Silva <ricardo.garcia.silva@geobeyond.it>
#
# Copyright (c) 2024 Tom Kralidis
# Copyright (c) 2024 Francesco Bartoli
# Copyright (c) 2022 John A Stevenson and Colin Blackburn
# Copyright (c) 2023 Ricardo Garcia Silva
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
# files (the "Software"), to deal in the Software without
# restriction, including without limitation the rights to use,
# copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following
# conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
#
# =================================================================
""" Module for API EDR, passing content provided by web framework.
Returns content from plugins and sets responses for that specification.
"""


from pygeoapi.api_ import ConformanceClasses


conformance_classes = [
'http://www.opengis.net/spec/ogcapi-edr-1/1.0/conf/core'
]

conformance = ConformanceClasses(name='edr', classes=conformance_classes)
58 changes: 58 additions & 0 deletions pygeoapi/api_/feature.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# =================================================================
#
# Authors: Tom Kralidis <tomkralidis@gmail.com>
# Francesco Bartoli <xbartolone@gmail.com>
# Sander Schaminee <sander.schaminee@geocat.net>
# John A Stevenson <jostev@bgs.ac.uk>
# Colin Blackburn <colb@bgs.ac.uk>
# Ricardo Garcia Silva <ricardo.garcia.silva@geobeyond.it>
#
# Copyright (c) 2024 Tom Kralidis
# Copyright (c) 2024 Francesco Bartoli
# Copyright (c) 2022 John A Stevenson and Colin Blackburn
# Copyright (c) 2023 Ricardo Garcia Silva
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
# files (the "Software"), to deal in the Software without
# restriction, including without limitation the rights to use,
# copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following
# conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
#
# =================================================================
""" Module for API Features, passing content provided by web framework.
Returns content from plugins and sets responses for that specification.
"""


from pygeoapi.api_ import ConformanceClasses


conformance_classes = [
'http://www.opengis.net/spec/ogcapi-features-1/1.0/conf/core',
'http://www.opengis.net/spec/ogcapi-features-1/1.0/req/oas30',
'http://www.opengis.net/spec/ogcapi-features-1/1.0/conf/html',
'http://www.opengis.net/spec/ogcapi-features-1/1.0/conf/geojson',
'http://www.opengis.net/spec/ogcapi-features-2/1.0/conf/crs',
'http://www.opengis.net/spec/ogcapi-features-3/1.0/conf/queryables',
'http://www.opengis.net/spec/ogcapi-features-3/1.0/conf/queryables-query-parameters', # noqa
'http://www.opengis.net/spec/ogcapi-features-4/1.0/conf/create-replace-delete', # noqa
'http://www.opengis.net/spec/ogcapi-features-5/1.0/conf/schemas',
'http://www.opengis.net/spec/ogcapi-features-5/1.0/req/core-roles-features' # noqa
]

conformance = ConformanceClasses(name='feature', classes=conformance_classes)
Loading