Skip to content

Instantly share code, notes, and snippets.

@epifanio
Created January 13, 2023 12:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save epifanio/a932e4c8f2a6362959f7816cf2fbb635 to your computer and use it in GitHub Desktop.
Save epifanio/a932e4c8f2a6362959f7816cf2fbb635 to your computer and use it in GitHub Desktop.
test log
epi@epi:~/dev/pygeoapi$ docker run -it epinux/pygeoapi:test test
START /entrypoint.sh
Trying to generate openapi.yml
Error Number: 1, Type: Failure, Msg: HTTP error code : 400
Error Number: 1, Type: Failure, Msg: Error returned by server : HTTP error code : 400 (0)
Error Number: 1, Type: Failure, Msg: HTTP error code : 400
Generating /pygeoapi/local.openapi.yml
Done
openapi.yml generated continue to pygeoapi
=============================================================================== test session starts ===============================================================================
platform linux -- Python 3.10.6, pytest-6.2.5, py-1.10.0, pluggy-0.13.0
rootdir: /pygeoapi, configfile: pytest.ini
collected 44 items
tests/test_api.py ............FFFFFFFFF.....F.....F........... [100%]
==================================================================================== FAILURES =====================================================================================
____________________________________________________________________ test_get_collection_items_postgresql_cql _____________________________________________________________________
pg_api_ = <pygeoapi.api.API object at 0x7fc16f936f20>
def test_get_collection_items_postgresql_cql(pg_api_):
"""
Test for PostgreSQL CQL - requires local PostgreSQL with appropriate
data. See pygeoapi/provider/postgresql.py for details.
"""
# Arrange
cql_query = 'osm_id BETWEEN 80800000 AND 80900000 AND name IS NULL'
expected_ids = [80835474, 80835483]
# Act
req = mock_request({
'filter-lang': 'cql-text',
'filter': cql_query
})
rsp_headers, code, response = pg_api_.get_collection_items(
req, 'hot_osm_waterways')
# Assert
> assert code == HTTPStatus.OK
E assert <HTTPStatus.INTERNAL_SERVER_ERROR: 500> == <HTTPStatus.OK: 200>
E + where <HTTPStatus.OK: 200> = HTTPStatus.OK
tests/test_api.py:866: AssertionError
-------------------------------------------------------------------------------- Captured log call --------------------------------------------------------------------------------
WARNING pygeoapi.api:api.py:1342 int() argument must be a string, a bytes-like object or a real number, not 'NoneType'
WARNING pygeoapi.api:api.py:1361 int() argument must be a string, a bytes-like object or a real number, not 'NoneType'
ERROR pygeoapi.api:api.py:3807 connection error (check logs)
________________________________________________________ test_get_collection_items_postgresql_cql_invalid_filter_language _________________________________________________________
pg_api_ = <pygeoapi.api.API object at 0x7fc16e6a6e90>
def test_get_collection_items_postgresql_cql_invalid_filter_language(pg_api_):
"""
Test for PostgreSQL CQL - requires local PostgreSQL with appropriate
data. See pygeoapi/provider/postgresql.py for details.
Test for invalid filter language
"""
# Arrange
cql_query = 'osm_id BETWEEN 80800000 AND 80900000 AND name IS NULL'
# Act
req = mock_request({
'filter-lang': 'cql-json', # Only cql-text is valid for GET
'filter': cql_query
})
rsp_headers, code, response = pg_api_.get_collection_items(
req, 'hot_osm_waterways')
# Assert
> assert code == HTTPStatus.BAD_REQUEST
E assert <HTTPStatus.INTERNAL_SERVER_ERROR: 500> == <HTTPStatus.BAD_REQUEST: 400>
E + where <HTTPStatus.BAD_REQUEST: 400> = HTTPStatus.BAD_REQUEST
tests/test_api.py:904: AssertionError
-------------------------------------------------------------------------------- Captured log call --------------------------------------------------------------------------------
WARNING pygeoapi.api:api.py:1342 int() argument must be a string, a bytes-like object or a real number, not 'NoneType'
WARNING pygeoapi.api:api.py:1361 int() argument must be a string, a bytes-like object or a real number, not 'NoneType'
ERROR pygeoapi.api:api.py:3807 connection error (check logs)
_________________________________________________________ test_get_collection_items_postgresql_cql_bad_cql[id IN (1, ~)] __________________________________________________________
pg_api_ = <pygeoapi.api.API object at 0x7fc16e6a7940>, bad_cql = 'id IN (1, ~)'
@pytest.mark.parametrize("bad_cql", [
'id IN (1, ~)',
'id EATS (1, 2)', # Valid CQL relations only
'id IN (1, 2' # At some point this may return UnexpectedEOF
])
def test_get_collection_items_postgresql_cql_bad_cql(pg_api_, bad_cql):
"""
Test for PostgreSQL CQL - requires local PostgreSQL with appropriate
data. See pygeoapi/provider/postgresql.py for details.
Test for bad cql
"""
# Act
req = mock_request({
'filter': bad_cql
})
rsp_headers, code, response = pg_api_.get_collection_items(
req, 'hot_osm_waterways')
# Assert
> assert code == HTTPStatus.BAD_REQUEST
E assert <HTTPStatus.INTERNAL_SERVER_ERROR: 500> == <HTTPStatus.BAD_REQUEST: 400>
E + where <HTTPStatus.BAD_REQUEST: 400> = HTTPStatus.BAD_REQUEST
tests/test_api.py:930: AssertionError
-------------------------------------------------------------------------------- Captured log call --------------------------------------------------------------------------------
WARNING pygeoapi.api:api.py:1342 int() argument must be a string, a bytes-like object or a real number, not 'NoneType'
WARNING pygeoapi.api:api.py:1361 int() argument must be a string, a bytes-like object or a real number, not 'NoneType'
ERROR pygeoapi.api:api.py:3807 connection error (check logs)
________________________________________________________ test_get_collection_items_postgresql_cql_bad_cql[id EATS (1, 2)] _________________________________________________________
pg_api_ = <pygeoapi.api.API object at 0x7fc176be1c60>, bad_cql = 'id EATS (1, 2)'
@pytest.mark.parametrize("bad_cql", [
'id IN (1, ~)',
'id EATS (1, 2)', # Valid CQL relations only
'id IN (1, 2' # At some point this may return UnexpectedEOF
])
def test_get_collection_items_postgresql_cql_bad_cql(pg_api_, bad_cql):
"""
Test for PostgreSQL CQL - requires local PostgreSQL with appropriate
data. See pygeoapi/provider/postgresql.py for details.
Test for bad cql
"""
# Act
req = mock_request({
'filter': bad_cql
})
rsp_headers, code, response = pg_api_.get_collection_items(
req, 'hot_osm_waterways')
# Assert
> assert code == HTTPStatus.BAD_REQUEST
E assert <HTTPStatus.INTERNAL_SERVER_ERROR: 500> == <HTTPStatus.BAD_REQUEST: 400>
E + where <HTTPStatus.BAD_REQUEST: 400> = HTTPStatus.BAD_REQUEST
tests/test_api.py:930: AssertionError
-------------------------------------------------------------------------------- Captured log call --------------------------------------------------------------------------------
WARNING pygeoapi.api:api.py:1342 int() argument must be a string, a bytes-like object or a real number, not 'NoneType'
WARNING pygeoapi.api:api.py:1361 int() argument must be a string, a bytes-like object or a real number, not 'NoneType'
ERROR pygeoapi.api:api.py:3807 connection error (check logs)
__________________________________________________________ test_get_collection_items_postgresql_cql_bad_cql[id IN (1, 2] __________________________________________________________
pg_api_ = <pygeoapi.api.API object at 0x7fc16e3d8160>, bad_cql = 'id IN (1, 2'
@pytest.mark.parametrize("bad_cql", [
'id IN (1, ~)',
'id EATS (1, 2)', # Valid CQL relations only
'id IN (1, 2' # At some point this may return UnexpectedEOF
])
def test_get_collection_items_postgresql_cql_bad_cql(pg_api_, bad_cql):
"""
Test for PostgreSQL CQL - requires local PostgreSQL with appropriate
data. See pygeoapi/provider/postgresql.py for details.
Test for bad cql
"""
# Act
req = mock_request({
'filter': bad_cql
})
rsp_headers, code, response = pg_api_.get_collection_items(
req, 'hot_osm_waterways')
# Assert
> assert code == HTTPStatus.BAD_REQUEST
E assert <HTTPStatus.INTERNAL_SERVER_ERROR: 500> == <HTTPStatus.BAD_REQUEST: 400>
E + where <HTTPStatus.BAD_REQUEST: 400> = HTTPStatus.BAD_REQUEST
tests/test_api.py:930: AssertionError
-------------------------------------------------------------------------------- Captured log call --------------------------------------------------------------------------------
WARNING pygeoapi.api:api.py:1342 int() argument must be a string, a bytes-like object or a real number, not 'NoneType'
WARNING pygeoapi.api:api.py:1361 int() argument must be a string, a bytes-like object or a real number, not 'NoneType'
ERROR pygeoapi.api:api.py:3807 connection error (check logs)
____________________________________________________________________ test_post_collection_items_postgresql_cql ____________________________________________________________________
pg_api_ = <pygeoapi.api.API object at 0x7fc16e3a7cd0>
def test_post_collection_items_postgresql_cql(pg_api_):
"""
Test for PostgreSQL CQL - requires local PostgreSQL with appropriate
data. See pygeoapi/provider/postgresql.py for details.
"""
# Arrange
cql = {"and": [{"between": {"value": {"property": "osm_id"},
"lower": 80800000,
"upper": 80900000}},
{"isNull": {"property": "name"}}]}
# werkzeug requests use a value of CONTENT_TYPE 'application/json'
# to create Content-Type in the Request object. So here we need to
# overwrite the default CONTENT_TYPE with the required one.
headers = {'CONTENT_TYPE': 'application/query-cql-json'}
expected_ids = [80835474, 80835483]
# Act
req = mock_request({
'filter-lang': 'cql-json'
}, data=cql, **headers)
rsp_headers, code, response = pg_api_.post_collection_items(
req, 'hot_osm_waterways')
# Assert
> assert code == HTTPStatus.OK
E assert <HTTPStatus.INTERNAL_SERVER_ERROR: 500> == <HTTPStatus.OK: 200>
E + where <HTTPStatus.OK: 200> = HTTPStatus.OK
tests/test_api.py:960: AssertionError
-------------------------------------------------------------------------------- Captured log call --------------------------------------------------------------------------------
WARNING pygeoapi.api:api.py:1720 int() argument must be a string, a bytes-like object or a real number, not 'NoneType'
WARNING pygeoapi.api:api.py:1739 int() argument must be a string, a bytes-like object or a real number, not 'NoneType'
ERROR pygeoapi.api:api.py:3807 connection error (check logs)
________________________________________________________ test_post_collection_items_postgresql_cql_invalid_filter_language ________________________________________________________
pg_api_ = <pygeoapi.api.API object at 0x7fc16e3d8d00>
def test_post_collection_items_postgresql_cql_invalid_filter_language(pg_api_):
"""
Test for PostgreSQL CQL - requires local PostgreSQL with appropriate
data. See pygeoapi/provider/postgresql.py for details.
Test for invalid filter language
"""
# Arrange
# CQL should never be parsed
cql = {"in": {"value": {"property": "id"}, "list": [1, 2]}}
headers = {'CONTENT_TYPE': 'application/query-cql-json'}
# Act
req = mock_request({
'filter-lang': 'cql-text' # Only cql-json is valid for POST
}, data=cql, **headers)
rsp_headers, code, response = pg_api_.post_collection_items(
req, 'hot_osm_waterways')
# Assert
> assert code == HTTPStatus.BAD_REQUEST
E assert <HTTPStatus.INTERNAL_SERVER_ERROR: 500> == <HTTPStatus.BAD_REQUEST: 400>
E + where <HTTPStatus.BAD_REQUEST: 400> = HTTPStatus.BAD_REQUEST
tests/test_api.py:986: AssertionError
-------------------------------------------------------------------------------- Captured log call --------------------------------------------------------------------------------
WARNING pygeoapi.api:api.py:1720 int() argument must be a string, a bytes-like object or a real number, not 'NoneType'
WARNING pygeoapi.api:api.py:1739 int() argument must be a string, a bytes-like object or a real number, not 'NoneType'
ERROR pygeoapi.api:api.py:3807 connection error (check logs)
___________________________________________________________ test_post_collection_items_postgresql_cql_bad_cql[bad_cql0] ___________________________________________________________
pg_api_ = <pygeoapi.api.API object at 0x7fc16e3a4d00>, bad_cql = {'eats': {'list': [1, 2], 'value': {'property': 'id'}}}
@pytest.mark.parametrize("bad_cql", [
# Valid CQL relations only
{"eats": {"value": {"property": "id"}, "list": [1, 2]}},
# At some point this may return UnexpectedEOF
'{"in": {"value": {"property": "id"}, "list": [1, 2}}'
])
def test_post_collection_items_postgresql_cql_bad_cql(pg_api_, bad_cql):
"""
Test for PostgreSQL CQL - requires local PostgreSQL with appropriate
data. See pygeoapi/provider/postgresql.py for details.
Test for bad cql
"""
# Arrange
headers = {'CONTENT_TYPE': 'application/query-cql-json'}
# Act
req = mock_request({
'filter-lang': 'cql-json'
}, data=bad_cql, **headers)
rsp_headers, code, response = pg_api_.post_collection_items(
req, 'hot_osm_waterways')
# Assert
> assert code == HTTPStatus.BAD_REQUEST
E assert <HTTPStatus.INTERNAL_SERVER_ERROR: 500> == <HTTPStatus.BAD_REQUEST: 400>
E + where <HTTPStatus.BAD_REQUEST: 400> = HTTPStatus.BAD_REQUEST
tests/test_api.py:1016: AssertionError
-------------------------------------------------------------------------------- Captured log call --------------------------------------------------------------------------------
WARNING pygeoapi.api:api.py:1720 int() argument must be a string, a bytes-like object or a real number, not 'NoneType'
WARNING pygeoapi.api:api.py:1739 int() argument must be a string, a bytes-like object or a real number, not 'NoneType'
ERROR pygeoapi.api:api.py:3807 connection error (check logs)
_____________________________________ test_post_collection_items_postgresql_cql_bad_cql[{"in": {"value": {"property": "id"}, "list": [1, 2}}] _____________________________________
pg_api_ = <pygeoapi.api.API object at 0x7fc1769661d0>, bad_cql = '{"in": {"value": {"property": "id"}, "list": [1, 2}}'
@pytest.mark.parametrize("bad_cql", [
# Valid CQL relations only
{"eats": {"value": {"property": "id"}, "list": [1, 2]}},
# At some point this may return UnexpectedEOF
'{"in": {"value": {"property": "id"}, "list": [1, 2}}'
])
def test_post_collection_items_postgresql_cql_bad_cql(pg_api_, bad_cql):
"""
Test for PostgreSQL CQL - requires local PostgreSQL with appropriate
data. See pygeoapi/provider/postgresql.py for details.
Test for bad cql
"""
# Arrange
headers = {'CONTENT_TYPE': 'application/query-cql-json'}
# Act
req = mock_request({
'filter-lang': 'cql-json'
}, data=bad_cql, **headers)
rsp_headers, code, response = pg_api_.post_collection_items(
req, 'hot_osm_waterways')
# Assert
> assert code == HTTPStatus.BAD_REQUEST
E assert <HTTPStatus.INTERNAL_SERVER_ERROR: 500> == <HTTPStatus.BAD_REQUEST: 400>
E + where <HTTPStatus.BAD_REQUEST: 400> = HTTPStatus.BAD_REQUEST
tests/test_api.py:1016: AssertionError
-------------------------------------------------------------------------------- Captured log call --------------------------------------------------------------------------------
WARNING pygeoapi.api:api.py:1720 int() argument must be a string, a bytes-like object or a real number, not 'NoneType'
WARNING pygeoapi.api:api.py:1739 int() argument must be a string, a bytes-like object or a real number, not 'NoneType'
ERROR pygeoapi.api:api.py:3807 connection error (check logs)
__________________________________________________________________________ test_get_collection_coverage ___________________________________________________________________________
config = {'logging': {'level': 'DEBUG'}, 'metadata': {'contact': {'address': 'Mailing Address', 'city': 'City', 'country': 'Cou....}, ...}, 'server': {'bind': {'host': '0.0.0.0', 'port': 5000}, 'cors': True, 'encoding': 'utf-8', 'gzip': False, ...}}
api_ = <pygeoapi.api.API object at 0x7fc16e3a4940>
def test_get_collection_coverage(config, api_):
req = mock_request()
rsp_headers, code, response = api_.get_collection_coverage(
req, 'obs')
assert code == HTTPStatus.BAD_REQUEST
req = mock_request({'properties': '12'})
rsp_headers, code, response = api_.get_collection_coverage(
req, 'gdps-temperature')
assert code == HTTPStatus.BAD_REQUEST
req = mock_request({'subset': 'bad_axis(10:20)'})
rsp_headers, code, response = api_.get_collection_coverage(
req, 'gdps-temperature')
assert code == HTTPStatus.BAD_REQUEST
req = mock_request({'f': 'blah'})
rsp_headers, code, response = api_.get_collection_coverage(
req, 'gdps-temperature')
assert code == HTTPStatus.BAD_REQUEST
req = mock_request({'f': 'html'})
rsp_headers, code, response = api_.get_collection_coverage(
req, 'gdps-temperature')
assert code == HTTPStatus.BAD_REQUEST
assert rsp_headers['Content-Type'] == 'text/html'
req = mock_request(HTTP_ACCEPT='text/html')
rsp_headers, code, response = api_.get_collection_coverage(
req, 'gdps-temperature')
assert code == HTTPStatus.OK
assert rsp_headers['Content-Type'] == 'application/prs.coverage+json'
req = mock_request({'subset': 'Lat(5:10),Long(5:10)'})
rsp_headers, code, response = api_.get_collection_coverage(
req, 'gdps-temperature')
> assert code == HTTPStatus.OK
E assert <HTTPStatus.INTERNAL_SERVER_ERROR: 500> == <HTTPStatus.OK: 200>
E + where <HTTPStatus.OK: 200> = HTTPStatus.OK
tests/test_api.py:1250: AssertionError
-------------------------------------------------------------------------------- Captured log call --------------------------------------------------------------------------------
ERROR pygeoapi.api:api.py:3807 invalid provider type
ERROR pygeoapi.api:api.py:3807 Invalid field specified
ERROR pygeoapi.api:api.py:2339 Invalid axis name
ERROR pygeoapi.api:api.py:3807 Invalid axis name
ERROR pygeoapi.api:api.py:3807 Invalid format: blah
ERROR pygeoapi.api:api.py:3807 Invalid format: html
WARNING rasterio._env:rasterio_.py:314 CPLE_NotSupported in driver GRIB does not support creation option BBOX
WARNING rasterio._env:rasterio_.py:314 CPLE_NotSupported in driver GRIB does not support creation option UNITS
ERROR pygeoapi.provider.rasterio_:rasterio_.py:284 Input shapes do not overlap raster.
ERROR pygeoapi.api:api.py:3807 query error (check logs)
__________________________________________________________________________ test_get_collection_edr_query __________________________________________________________________________
config = {'logging': {'level': 'DEBUG'}, 'metadata': {'contact': {'address': 'Mailing Address', 'city': 'City', 'country': 'Cou....}, ...}, 'server': {'bind': {'host': '0.0.0.0', 'port': 5000}, 'cors': True, 'encoding': 'utf-8', 'gzip': False, ...}}
api_ = <pygeoapi.api.API object at 0x7fc16e3da650>
def test_get_collection_edr_query(config, api_):
# edr resource
req = mock_request()
rsp_headers, code, response = api_.describe_collections(req, 'icoads-sst')
collection = json.loads(response)
parameter_names = list(collection['parameter-names'].keys())
parameter_names.sort()
assert len(parameter_names) == 4
assert parameter_names == ['AIRT', 'SST', 'UWND', 'VWND']
# no coords parameter
rsp_headers, code, response = api_.get_collection_edr_query(
req, 'icoads-sst', None, 'position')
assert code == HTTPStatus.BAD_REQUEST
# bad query type
req = mock_request({'coords': 'POINT(11 11)'})
rsp_headers, code, response = api_.get_collection_edr_query(
req, 'icoads-sst', None, 'corridor')
assert code == HTTPStatus.BAD_REQUEST
# bad coords parameter
req = mock_request({'coords': 'gah'})
rsp_headers, code, response = api_.get_collection_edr_query(
req, 'icoads-sst', None, 'position')
assert code == HTTPStatus.BAD_REQUEST
# bad parameter-name parameter
req = mock_request({
'coords': 'POINT(11 11)', 'parameter-name': 'bad'
})
rsp_headers, code, response = api_.get_collection_edr_query(
req, 'icoads-sst', None, 'position')
assert code == HTTPStatus.BAD_REQUEST
# all parameters
req = mock_request({'coords': 'POINT(11 11)'})
rsp_headers, code, response = api_.get_collection_edr_query(
req, 'icoads-sst', None, 'position')
assert code == HTTPStatus.OK
data = json.loads(response)
axes = list(data['domain']['axes'].keys())
axes.sort()
assert len(axes) == 3
assert axes == ['TIME', 'x', 'y']
assert data['domain']['axes']['x']['start'] == 11.0
assert data['domain']['axes']['x']['stop'] == 11.0
assert data['domain']['axes']['y']['start'] == 11.0
assert data['domain']['axes']['y']['stop'] == 11.0
parameters = list(data['parameters'].keys())
parameters.sort()
assert len(parameters) == 4
assert parameters == ['AIRT', 'SST', 'UWND', 'VWND']
# single parameter
req = mock_request({
'coords': 'POINT(11 11)', 'parameter-name': 'SST'
})
rsp_headers, code, response = api_.get_collection_edr_query(
req, 'icoads-sst', None, 'position')
assert code == HTTPStatus.OK
data = json.loads(response)
assert len(data['parameters'].keys()) == 1
assert list(data['parameters'].keys())[0] == 'SST'
# some data
req = mock_request({
'coords': 'POINT(11 11)', 'datetime': '2000-01-16'
})
> rsp_headers, code, response = api_.get_collection_edr_query(
req, 'icoads-sst', None, 'position')
tests/test_api.py:1719:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
pygeoapi/api.py:195: in inner
headers, status, content = func(*args, **kwargs)
pygeoapi/api.py:177: in inner
return func(cls, req_out, *args[2:])
pygeoapi/api.py:3623: in get_collection_edr_query
data = p.query(**query_args)
pygeoapi/provider/base_edr.py:95: in query
return getattr(self, kwargs.get('query_type'))(**kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <BaseProvider> edr, kwargs = {'datetime_': '2000-01-16', 'format_': None, 'instance': None, 'query_type': 'position', ...}
query_params = {'COADSX': 11.0, 'COADSY': 11.0, 'TIME': '2000-01-16'}, wkt = <shapely.geometry.point.Point object at 0x7fc16b4b02b0>, select_properties = [], instance = None
datetime_ = '2000-01-16'
data = <xarray.Dataset>
Dimensions: ()
Coordinates:
COADSX float64 11.0
COADSY float64 11.0
TIME datetim... UWND float64 -7.779
VWND float64 -3.155
Attributes:
history: FERRET V4.30 (debug/no GUI) 15-Aug-96
@BaseEDRProvider.register()
def position(self, **kwargs):
"""
Extract data from collection collection
:param query_type: query type
:param wkt: `shapely.geometry` WKT geometry
:param datetime_: temporal (datestamp or extent)
:param select_properties: list of parameters
:param z: vertical level(s)
:param format_: data format of output
:returns: coverage data as dict of CoverageJSON or native format
"""
query_params = {}
LOGGER.debug(f'Query parameters: {kwargs}')
LOGGER.debug(f"Query type: {kwargs.get('query_type')}")
wkt = kwargs.get('wkt')
if wkt is not None:
LOGGER.debug('Processing WKT')
LOGGER.debug(f'Geometry type: {wkt.type}')
if wkt.type == 'Point':
query_params[self._coverage_properties['x_axis_label']] = wkt.x
query_params[self._coverage_properties['y_axis_label']] = wkt.y
elif wkt.type == 'LineString':
query_params[self._coverage_properties['x_axis_label']] = wkt.xy[0] # noqa
query_params[self._coverage_properties['y_axis_label']] = wkt.xy[1] # noqa
elif wkt.type == 'Polygon':
query_params[self._coverage_properties['x_axis_label']] = slice(wkt.bounds[0], wkt.bounds[2]) # noqa
query_params[self._coverage_properties['y_axis_label']] = slice(wkt.bounds[1], wkt.bounds[3]) # noqa
pass
LOGGER.debug('Processing parameter-name')
select_properties = kwargs.get('select_properties')
# example of fetching instance passed
# TODO: apply accordingly
instance = kwargs.get('instance')
LOGGER.debug(f'instance: {instance}')
datetime_ = kwargs.get('datetime_')
if datetime_ is not None:
query_params[self._coverage_properties['time_axis_label']] = datetime_ # noqa
LOGGER.debug(f'query parameters: {query_params}')
try:
if select_properties:
self.fields = select_properties
data = self._data[[*select_properties]]
else:
data = self._data
data = data.sel(query_params, method='nearest')
except KeyError:
raise ProviderNoDataError()
> if len(data.coords[self.time_field].values) < 1:
E TypeError: object of type 'numpy.datetime64' has no len()
pygeoapi/provider/xarray_edr.py:123: TypeError
-------------------------------------------------------------------------------- Captured log call --------------------------------------------------------------------------------
ERROR pygeoapi.api:api.py:3807 missing coords parameter
ERROR pygeoapi.api:api.py:3807 Unsupported query type
ERROR shapely.geos:geos.py:263 ParseException: Unknown type: 'GAH'
ERROR pygeoapi.api:api.py:3807 invalid coords parameter
ERROR pygeoapi.api:api.py:3807 Invalid parameter-name
================================================================================ warnings summary =================================================================================
../usr/lib/python3/dist-packages/_pytest/config/__init__.py:1233
/usr/lib/python3/dist-packages/_pytest/config/__init__.py:1233: PytestConfigWarning: Unknown config option: env
self._warn_or_fail_if_strict(f"Unknown config option: {key}\n")
tests/test_api.py: 16 warnings
/usr/lib/python3/dist-packages/jinja2/environment.py:362: DeprecationWarning: The 'autoescape' extension is deprecated and will be removed in Jinja 3.1. This is built in now.
self.extensions = load_extensions(self, extensions)
tests/test_api.py::test_get_collection_items_postgresql_cql
/pygeoapi/pygeoapi/provider/postgresql.py:274: RemovedIn20Warning: Deprecated API features detected! These feature(s) are not compatible with SQLAlchemy 2.0. To prevent incompatible upgrades prior to updating applications, ensure requirements files are pinned to "sqlalchemy<2.0". Set environment variable SQLALCHEMY_WARN_20=1 to show all deprecation warnings. Set environment variable SQLALCHEMY_SILENCE_UBER_WARNING=1 to silence this message. (Background on SQLAlchemy 2.0 at: https://sqlalche.me/e/b8d9)
metadata = MetaData(engine)
tests/test_api.py::test_get_collection_edr_query
<frozen importlib._bootstrap>:241: RuntimeWarning: numpy.ndarray size changed, may indicate binary incompatibility. Expected 16 from C header, got 88 from PyObject
tests/test_api.py::test_get_collection_edr_query
/usr/lib/python3/dist-packages/xarray/backends/plugins.py:105: DeprecationWarning: SelectableGroups dict interface is deprecated. Use select.
entrypoints = entry_points().get("xarray.backends", ())
-- Docs: https://docs.pytest.org/en/stable/warnings.html
============================================================================= short test summary info =============================================================================
FAILED tests/test_api.py::test_get_collection_items_postgresql_cql - assert <HTTPStatus.INTERNAL_SERVER_ERROR: 500> == <HTTPStatus.OK: 200>
FAILED tests/test_api.py::test_get_collection_items_postgresql_cql_invalid_filter_language - assert <HTTPStatus.INTERNAL_SERVER_ERROR: 500> == <HTTPStatus.BAD_REQUEST: 400>
FAILED tests/test_api.py::test_get_collection_items_postgresql_cql_bad_cql[id IN (1, ~)] - assert <HTTPStatus.INTERNAL_SERVER_ERROR: 500> == <HTTPStatus.BAD_REQUEST: 400>
FAILED tests/test_api.py::test_get_collection_items_postgresql_cql_bad_cql[id EATS (1, 2)] - assert <HTTPStatus.INTERNAL_SERVER_ERROR: 500> == <HTTPStatus.BAD_REQUEST: 400>
FAILED tests/test_api.py::test_get_collection_items_postgresql_cql_bad_cql[id IN (1, 2] - assert <HTTPStatus.INTERNAL_SERVER_ERROR: 500> == <HTTPStatus.BAD_REQUEST: 400>
FAILED tests/test_api.py::test_post_collection_items_postgresql_cql - assert <HTTPStatus.INTERNAL_SERVER_ERROR: 500> == <HTTPStatus.OK: 200>
FAILED tests/test_api.py::test_post_collection_items_postgresql_cql_invalid_filter_language - assert <HTTPStatus.INTERNAL_SERVER_ERROR: 500> == <HTTPStatus.BAD_REQUEST: 400>
FAILED tests/test_api.py::test_post_collection_items_postgresql_cql_bad_cql[bad_cql0] - assert <HTTPStatus.INTERNAL_SERVER_ERROR: 500> == <HTTPStatus.BAD_REQUEST: 400>
FAILED tests/test_api.py::test_post_collection_items_postgresql_cql_bad_cql[{"in": {"value": {"property": "id"}, "list": [1, 2}}] - assert <HTTPStatus.INTERNAL_SERVER_ERROR: 50...
FAILED tests/test_api.py::test_get_collection_coverage - assert <HTTPStatus.INTERNAL_SERVER_ERROR: 500> == <HTTPStatus.OK: 200>
FAILED tests/test_api.py::test_get_collection_edr_query - TypeError: object of type 'numpy.datetime64' has no len()
=================================================================== 11 failed, 33 passed, 20 warnings in 18.79s ===================================================================
=============================================================================== test session starts ===============================================================================
platform linux -- Python 3.10.6, pytest-6.2.5, py-1.10.0, pluggy-0.13.0
rootdir: /pygeoapi, configfile: pytest.ini
collected 2 items
tests/test_config.py .. [100%]
================================================================================ warnings summary =================================================================================
../usr/lib/python3/dist-packages/_pytest/config/__init__.py:1233
/usr/lib/python3/dist-packages/_pytest/config/__init__.py:1233: PytestConfigWarning: Unknown config option: env
self._warn_or_fail_if_strict(f"Unknown config option: {key}\n")
-- Docs: https://docs.pytest.org/en/stable/warnings.html
========================================================================== 2 passed, 1 warning in 0.72s ===========================================================================
=============================================================================== test session starts ===============================================================================
platform linux -- Python 3.10.6, pytest-6.2.5, py-1.10.0, pluggy-0.13.0
rootdir: /pygeoapi, configfile: pytest.ini
collected 1 item
tests/test_csv__formatter.py . [100%]
================================================================================ warnings summary =================================================================================
../usr/lib/python3/dist-packages/_pytest/config/__init__.py:1233
/usr/lib/python3/dist-packages/_pytest/config/__init__.py:1233: PytestConfigWarning: Unknown config option: env
self._warn_or_fail_if_strict(f"Unknown config option: {key}\n")
-- Docs: https://docs.pytest.org/en/stable/warnings.html
========================================================================== 1 passed, 1 warning in 0.32s ===========================================================================
=============================================================================== test session starts ===============================================================================
platform linux -- Python 3.10.6, pytest-6.2.5, py-1.10.0, pluggy-0.13.0
rootdir: /pygeoapi, configfile: pytest.ini
collected 3 items
tests/test_csv__provider.py ... [100%]
================================================================================ warnings summary =================================================================================
../usr/lib/python3/dist-packages/_pytest/config/__init__.py:1233
/usr/lib/python3/dist-packages/_pytest/config/__init__.py:1233: PytestConfigWarning: Unknown config option: env
self._warn_or_fail_if_strict(f"Unknown config option: {key}\n")
-- Docs: https://docs.pytest.org/en/stable/warnings.html
========================================================================== 3 passed, 1 warning in 0.38s ===========================================================================
Skipping: tests/test_elasticsearch__provider.py
=============================================================================== test session starts ===============================================================================
platform linux -- Python 3.10.6, pytest-6.2.5, py-1.10.0, pluggy-0.13.0
rootdir: /pygeoapi, configfile: pytest.ini
collected 6 items
tests/test_esri_provider.py ...... [100%]
================================================================================ warnings summary =================================================================================
../usr/lib/python3/dist-packages/_pytest/config/__init__.py:1233
/usr/lib/python3/dist-packages/_pytest/config/__init__.py:1233: PytestConfigWarning: Unknown config option: env
self._warn_or_fail_if_strict(f"Unknown config option: {key}\n")
-- Docs: https://docs.pytest.org/en/stable/warnings.html
========================================================================== 6 passed, 1 warning in 13.86s ==========================================================================
=============================================================================== test session starts ===============================================================================
platform linux -- Python 3.10.6, pytest-6.2.5, py-1.10.0, pluggy-0.13.0
rootdir: /pygeoapi, configfile: pytest.ini
collected 1 item
tests/test_filesystem_provider.py . [100%]
================================================================================ warnings summary =================================================================================
../usr/lib/python3/dist-packages/_pytest/config/__init__.py:1233
/usr/lib/python3/dist-packages/_pytest/config/__init__.py:1233: PytestConfigWarning: Unknown config option: env
self._warn_or_fail_if_strict(f"Unknown config option: {key}\n")
-- Docs: https://docs.pytest.org/en/stable/warnings.html
========================================================================== 1 passed, 1 warning in 0.42s ===========================================================================
=============================================================================== test session starts ===============================================================================
platform linux -- Python 3.10.6, pytest-6.2.5, py-1.10.0, pluggy-0.13.0
rootdir: /pygeoapi, configfile: pytest.ini
collected 6 items
tests/test_geojson_provider.py ...... [100%]
================================================================================ warnings summary =================================================================================
../usr/lib/python3/dist-packages/_pytest/config/__init__.py:1233
/usr/lib/python3/dist-packages/_pytest/config/__init__.py:1233: PytestConfigWarning: Unknown config option: env
self._warn_or_fail_if_strict(f"Unknown config option: {key}\n")
-- Docs: https://docs.pytest.org/en/stable/warnings.html
========================================================================== 6 passed, 1 warning in 0.33s ===========================================================================
=============================================================================== test session starts ===============================================================================
platform linux -- Python 3.10.6, pytest-6.2.5, py-1.10.0, pluggy-0.13.0
rootdir: /pygeoapi, configfile: pytest.ini
collected 11 items
tests/test_l10n.py ........... [100%]
================================================================================ warnings summary =================================================================================
../usr/lib/python3/dist-packages/_pytest/config/__init__.py:1233
/usr/lib/python3/dist-packages/_pytest/config/__init__.py:1233: PytestConfigWarning: Unknown config option: env
self._warn_or_fail_if_strict(f"Unknown config option: {key}\n")
-- Docs: https://docs.pytest.org/en/stable/warnings.html
========================================================================== 11 passed, 1 warning in 0.54s ==========================================================================
Skipping: tests/test_mongo_provider.py
=============================================================================== test session starts ===============================================================================
platform linux -- Python 3.10.6, pytest-6.2.5, py-1.10.0, pluggy-0.13.0
rootdir: /pygeoapi, configfile: pytest.ini
collected 9 items
tests/test_ogr_csv_provider.py ......... [100%]
================================================================================ warnings summary =================================================================================
../usr/lib/python3/dist-packages/_pytest/config/__init__.py:1233
/usr/lib/python3/dist-packages/_pytest/config/__init__.py:1233: PytestConfigWarning: Unknown config option: env
self._warn_or_fail_if_strict(f"Unknown config option: {key}\n")
-- Docs: https://docs.pytest.org/en/stable/warnings.html
========================================================================== 9 passed, 1 warning in 5.89s ===========================================================================
=============================================================================== test session starts ===============================================================================
platform linux -- Python 3.10.6, pytest-6.2.5, py-1.10.0, pluggy-0.13.0
rootdir: /pygeoapi, configfile: pytest.ini
collected 7 items
tests/test_ogr_esrijson_provider.py ....... [100%]
================================================================================ warnings summary =================================================================================
../usr/lib/python3/dist-packages/_pytest/config/__init__.py:1233
/usr/lib/python3/dist-packages/_pytest/config/__init__.py:1233: PytestConfigWarning: Unknown config option: env
self._warn_or_fail_if_strict(f"Unknown config option: {key}\n")
-- Docs: https://docs.pytest.org/en/stable/warnings.html
========================================================================== 7 passed, 1 warning in 59.79s ==========================================================================
=============================================================================== test session starts ===============================================================================
platform linux -- Python 3.10.6, pytest-6.2.5, py-1.10.0, pluggy-0.13.0
rootdir: /pygeoapi, configfile: pytest.ini
collected 19 items
tests/test_ogr_gpkg_provider.py ................... [100%]
================================================================================ warnings summary =================================================================================
../usr/lib/python3/dist-packages/_pytest/config/__init__.py:1233
/usr/lib/python3/dist-packages/_pytest/config/__init__.py:1233: PytestConfigWarning: Unknown config option: env
self._warn_or_fail_if_strict(f"Unknown config option: {key}\n")
-- Docs: https://docs.pytest.org/en/stable/warnings.html
========================================================================== 19 passed, 1 warning in 0.72s ==========================================================================
=============================================================================== test session starts ===============================================================================
platform linux -- Python 3.10.6, pytest-6.2.5, py-1.10.0, pluggy-0.13.0
rootdir: /pygeoapi, configfile: pytest.ini
collected 17 items
tests/test_ogr_shapefile_provider.py ................. [100%]
================================================================================ warnings summary =================================================================================
../usr/lib/python3/dist-packages/_pytest/config/__init__.py:1233
/usr/lib/python3/dist-packages/_pytest/config/__init__.py:1233: PytestConfigWarning: Unknown config option: env
self._warn_or_fail_if_strict(f"Unknown config option: {key}\n")
-- Docs: https://docs.pytest.org/en/stable/warnings.html
========================================================================== 17 passed, 1 warning in 1.15s ==========================================================================
=============================================================================== test session starts ===============================================================================
platform linux -- Python 3.10.6, pytest-6.2.5, py-1.10.0, pluggy-0.13.0
rootdir: /pygeoapi, configfile: pytest.ini
collected 10 items
tests/test_ogr_sqlite_provider.py .......... [100%]
================================================================================ warnings summary =================================================================================
../usr/lib/python3/dist-packages/_pytest/config/__init__.py:1233
/usr/lib/python3/dist-packages/_pytest/config/__init__.py:1233: PytestConfigWarning: Unknown config option: env
self._warn_or_fail_if_strict(f"Unknown config option: {key}\n")
-- Docs: https://docs.pytest.org/en/stable/warnings.html
========================================================================== 10 passed, 1 warning in 0.48s ==========================================================================
=============================================================================== test session starts ===============================================================================
platform linux -- Python 3.10.6, pytest-6.2.5, py-1.10.0, pluggy-0.13.0
rootdir: /pygeoapi, configfile: pytest.ini
collected 21 items
tests/test_ogr_wfs_provider.py ..F.......F..F..F.... [100%]
==================================================================================== FAILURES =====================================================================================
_______________________________________________________________________________ test_get_geosol_gs ________________________________________________________________________________
self = <OGRProvider> {'source_type': 'WFS', 'source': 'WFS:https://demo.geo-solutions.it/geoserver/wfs?', 'source_srs': 'EPSG...e_options': {'OGR_WFS_LOAD_MULTIPLE_LAYER_DEFN': 'NO'}, 'gdal_ogr_options': {'GDAL_CACHEMAX': '64', 'CPL_DEBUG': 'NO'}}
identifier = 'Unesco_point.123', kwargs = {}, result = None
def get(self, identifier, **kwargs):
"""
Get Feature by id
:param identifier: feature id
:returns: feature collection
"""
result = None
try:
LOGGER.debug(f'Fetching identifier {identifier}')
> layer = self._get_layer()
pygeoapi/provider/ogr.py:386:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <OGRProvider> {'source_type': 'WFS', 'source': 'WFS:https://demo.geo-solutions.it/geoserver/wfs?', 'source_srs': 'EPSG...e_options': {'OGR_WFS_LOAD_MULTIPLE_LAYER_DEFN': 'NO'}, 'gdal_ogr_options': {'GDAL_CACHEMAX': '64', 'CPL_DEBUG': 'NO'}}
def _get_layer(self):
if not self.conn:
> self._open()
pygeoapi/provider/ogr.py:246:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <OGRProvider> {'source_type': 'WFS', 'source': 'WFS:https://demo.geo-solutions.it/geoserver/wfs?', 'source_srs': 'EPSG...e_options': {'OGR_WFS_LOAD_MULTIPLE_LAYER_DEFN': 'NO'}, 'gdal_ogr_options': {'GDAL_CACHEMAX': '64', 'CPL_DEBUG': 'NO'}}
def _open(self):
source_type = self.data_def['source_type']
self.driver = self.ogr.GetDriverByName(source_type)
if not self.driver:
msg = f'No Driver for Source: {source_type}'
LOGGER.error(msg)
raise Exception(msg)
if self.open_options:
try:
self.conn = self.gdal.OpenEx(
self.data_def['source'],
self.gdal.OF_VECTOR,
open_options=self._list_open_options())
except RuntimeError as err:
LOGGER.error(err)
raise ProviderConnectionError(err)
except Exception:
msg = f'Ignore errors during the connection for Driver {source_type}' # noqa
LOGGER.error(msg)
self.conn = _ignore_gdal_error(
self.gdal, 'OpenEx', self.data_def['source'],
self.gdal.OF_VECTOR,
open_options=self._list_open_options())
else:
try:
self.conn = self.driver.Open(self.data_def['source'], 0)
except RuntimeError as err:
LOGGER.error(err)
raise ProviderConnectionError(err)
except Exception:
msg = f'Ignore errors during the connection for Driver {source_type}' # noqa
LOGGER.error(msg)
# ignore errors for ESRIJSON not having geometry member
# see https://github.com/OSGeo/gdal/commit/38b0feed67f80ded32be6c508323d862e1a14474 # noqa
self.conn = _ignore_gdal_error(
self.driver, 'Open', self.data_def['source'], 0)
if not self.conn:
msg = 'Cannot open OGR Source: %s' % self.data_def['source']
LOGGER.error(msg)
> raise Exception(msg)
E Exception: Cannot open OGR Source: WFS:https://demo.geo-solutions.it/geoserver/wfs?
pygeoapi/provider/ogr.py:231: Exception
During handling of the above exception, another exception occurred:
config_geosol_gs_WFS = {'data': {'gdal_ogr_options': {'CPL_DEBUG': 'NO', 'GDAL_CACHEMAX': '64'}, 'source': 'WFS:https://demo.geo-solutions.it...R_WFS_LOAD_MULTIPLE_LAYER_DEFN': 'NO'}, ...}, 'id_field': 'gml_id', 'layer': 'unesco:Unesco_point', 'name': 'OGR', ...}
def test_get_geosol_gs(config_geosol_gs_WFS):
"""Testing query for a specific object"""
p = OGRProvider(config_geosol_gs_WFS)
> result = p.get('Unesco_point.123')
tests/test_ogr_wfs_provider.py:193:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <OGRProvider> {'source_type': 'WFS', 'source': 'WFS:https://demo.geo-solutions.it/geoserver/wfs?', 'source_srs': 'EPSG...e_options': {'OGR_WFS_LOAD_MULTIPLE_LAYER_DEFN': 'NO'}, 'gdal_ogr_options': {'GDAL_CACHEMAX': '64', 'CPL_DEBUG': 'NO'}}
identifier = 'Unesco_point.123', kwargs = {}, result = None
def get(self, identifier, **kwargs):
"""
Get Feature by id
:param identifier: feature id
:returns: feature collection
"""
result = None
try:
LOGGER.debug(f'Fetching identifier {identifier}')
layer = self._get_layer()
layer.SetAttributeFilter(f"{self.id_field} = '{identifier}'")
ogr_feature = self._get_next_feature(layer, identifier)
result = self._ogr_feature_to_json(ogr_feature)
except RuntimeError as err:
LOGGER.error(err)
raise ProviderQueryError(err)
except ProviderConnectionError as err:
LOGGER.error(err)
raise ProviderConnectionError(err)
except ProviderItemNotFoundError as err:
LOGGER.error(err)
raise ProviderItemNotFoundError(err)
except Exception as err:
LOGGER.error(err)
> raise ProviderGenericError(err)
E pygeoapi.provider.base.ProviderGenericError: Cannot open OGR Source: WFS:https://demo.geo-solutions.it/geoserver/wfs?
pygeoapi/provider/ogr.py:404: ProviderGenericError
-------------------------------------------------------------------------------- Captured log call --------------------------------------------------------------------------------
ERROR pygeoapi.provider.ogr:ogr.py:811 Error Number: 1, Type: Failure, Msg: HTTP error code : 503
ERROR pygeoapi.provider.ogr:ogr.py:223 Ignore errors during the connection for Driver WFS
ERROR pygeoapi.provider.ogr:ogr.py:230 Cannot open OGR Source: WFS:https://demo.geo-solutions.it/geoserver/wfs?
ERROR pygeoapi.provider.ogr:ogr.py:289 Cannot open OGR Source: WFS:https://demo.geo-solutions.it/geoserver/wfs?
ERROR pygeoapi.provider.ogr:ogr.py:811 Error Number: 1, Type: Failure, Msg: HTTP error code : 503
ERROR pygeoapi.provider.ogr:ogr.py:223 Ignore errors during the connection for Driver WFS
ERROR pygeoapi.provider.ogr:ogr.py:230 Cannot open OGR Source: WFS:https://demo.geo-solutions.it/geoserver/wfs?
ERROR pygeoapi.provider.ogr:ogr.py:403 Cannot open OGR Source: WFS:https://demo.geo-solutions.it/geoserver/wfs?
____________________________________________________________________________ test_query_hits_geosol_gs ____________________________________________________________________________
self = <OGRProvider> {'source_type': 'WFS', 'source': 'WFS:https://demo.geo-solutions.it/geoserver/wfs?', 'source_srs': 'EPSG...e_options': {'OGR_WFS_LOAD_MULTIPLE_LAYER_DEFN': 'NO'}, 'gdal_ogr_options': {'GDAL_CACHEMAX': '64', 'CPL_DEBUG': 'NO'}}
offset = 0, limit = 10, resulttype = 'hits', bbox = [], datetime_ = None, properties = [], sortby = [], select_properties = [], skip_geometry = False, q = None, kwargs = {}
result = None
def query(self, offset=0, limit=10, resulttype='results',
bbox=[], datetime_=None, properties=[], sortby=[],
select_properties=[], skip_geometry=False, q=None, **kwargs):
"""
Query OGR source
:param offset: starting record to return (default 0)
:param limit: number of records to return (default 10)
:param resulttype: return results or hit limit (default results)
:param bbox: bounding box [minx,miny,maxx,maxy]
:param datetime_: temporal (datestamp or extent)
:param properties: list of tuples (name, value)
:param sortby: list of dicts (property, order)
:param select_properties: list of property names
:param skip_geometry: bool of whether to skip geometry (default False)
:param q: full-text search term(s)
:returns: dict of 0..n GeoJSON features
"""
result = None
try:
if self.source_capabilities['paging']:
self.source_helper.enable_paging(offset, limit)
> layer = self._get_layer()
pygeoapi/provider/ogr.py:320:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <OGRProvider> {'source_type': 'WFS', 'source': 'WFS:https://demo.geo-solutions.it/geoserver/wfs?', 'source_srs': 'EPSG...e_options': {'OGR_WFS_LOAD_MULTIPLE_LAYER_DEFN': 'NO'}, 'gdal_ogr_options': {'GDAL_CACHEMAX': '64', 'CPL_DEBUG': 'NO'}}
def _get_layer(self):
if not self.conn:
> self._open()
pygeoapi/provider/ogr.py:246:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <OGRProvider> {'source_type': 'WFS', 'source': 'WFS:https://demo.geo-solutions.it/geoserver/wfs?', 'source_srs': 'EPSG...e_options': {'OGR_WFS_LOAD_MULTIPLE_LAYER_DEFN': 'NO'}, 'gdal_ogr_options': {'GDAL_CACHEMAX': '64', 'CPL_DEBUG': 'NO'}}
def _open(self):
source_type = self.data_def['source_type']
self.driver = self.ogr.GetDriverByName(source_type)
if not self.driver:
msg = f'No Driver for Source: {source_type}'
LOGGER.error(msg)
raise Exception(msg)
if self.open_options:
try:
self.conn = self.gdal.OpenEx(
self.data_def['source'],
self.gdal.OF_VECTOR,
open_options=self._list_open_options())
except RuntimeError as err:
LOGGER.error(err)
raise ProviderConnectionError(err)
except Exception:
msg = f'Ignore errors during the connection for Driver {source_type}' # noqa
LOGGER.error(msg)
self.conn = _ignore_gdal_error(
self.gdal, 'OpenEx', self.data_def['source'],
self.gdal.OF_VECTOR,
open_options=self._list_open_options())
else:
try:
self.conn = self.driver.Open(self.data_def['source'], 0)
except RuntimeError as err:
LOGGER.error(err)
raise ProviderConnectionError(err)
except Exception:
msg = f'Ignore errors during the connection for Driver {source_type}' # noqa
LOGGER.error(msg)
# ignore errors for ESRIJSON not having geometry member
# see https://github.com/OSGeo/gdal/commit/38b0feed67f80ded32be6c508323d862e1a14474 # noqa
self.conn = _ignore_gdal_error(
self.driver, 'Open', self.data_def['source'], 0)
if not self.conn:
msg = 'Cannot open OGR Source: %s' % self.data_def['source']
LOGGER.error(msg)
> raise Exception(msg)
E Exception: Cannot open OGR Source: WFS:https://demo.geo-solutions.it/geoserver/wfs?
pygeoapi/provider/ogr.py:231: Exception
During handling of the above exception, another exception occurred:
config_geosol_gs_WFS = {'data': {'gdal_ogr_options': {'CPL_DEBUG': 'NO', 'GDAL_CACHEMAX': '64'}, 'source': 'WFS:https://demo.geo-solutions.it...R_WFS_LOAD_MULTIPLE_LAYER_DEFN': 'NO'}, ...}, 'id_field': 'gml_id', 'layer': 'unesco:Unesco_point', 'name': 'OGR', ...}
def test_query_hits_geosol_gs(config_geosol_gs_WFS):
"""Testing query on entire collection for hits"""
p = OGRProvider(config_geosol_gs_WFS)
> feature_collection = p.query(resulttype='hits')
tests/test_ogr_wfs_provider.py:274:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <OGRProvider> {'source_type': 'WFS', 'source': 'WFS:https://demo.geo-solutions.it/geoserver/wfs?', 'source_srs': 'EPSG...e_options': {'OGR_WFS_LOAD_MULTIPLE_LAYER_DEFN': 'NO'}, 'gdal_ogr_options': {'GDAL_CACHEMAX': '64', 'CPL_DEBUG': 'NO'}}
offset = 0, limit = 10, resulttype = 'hits', bbox = [], datetime_ = None, properties = [], sortby = [], select_properties = [], skip_geometry = False, q = None, kwargs = {}
result = None
def query(self, offset=0, limit=10, resulttype='results',
bbox=[], datetime_=None, properties=[], sortby=[],
select_properties=[], skip_geometry=False, q=None, **kwargs):
"""
Query OGR source
:param offset: starting record to return (default 0)
:param limit: number of records to return (default 10)
:param resulttype: return results or hit limit (default results)
:param bbox: bounding box [minx,miny,maxx,maxy]
:param datetime_: temporal (datestamp or extent)
:param properties: list of tuples (name, value)
:param sortby: list of dicts (property, order)
:param select_properties: list of property names
:param skip_geometry: bool of whether to skip geometry (default False)
:param q: full-text search term(s)
:returns: dict of 0..n GeoJSON features
"""
result = None
try:
if self.source_capabilities['paging']:
self.source_helper.enable_paging(offset, limit)
layer = self._get_layer()
if bbox:
LOGGER.debug('processing bbox parameter')
minx, miny, maxx, maxy = [float(b) for b in bbox]
wkt = f"POLYGON (({minx} {miny},{minx} {maxy},{maxx} {maxy}," \
f"{maxx} {miny},{minx} {miny}))"
polygon = self.ogr.CreateGeometryFromWkt(wkt)
if self.transform_in:
polygon.Transform(self.transform_in)
layer.SetSpatialFilter(polygon)
# layer.SetSpatialFilterRect(
# float(minx), float(miny), float(maxx), float(maxy))
if properties:
LOGGER.debug('processing properties')
attribute_filter = ' and '.join(
map(lambda x: f'{x[0]} = \'{x[1]}\'', properties)
)
LOGGER.debug(attribute_filter)
layer.SetAttributeFilter(attribute_filter)
# Make response based on resulttype specified
if resulttype == 'hits':
LOGGER.debug('hits only specified')
result = self._response_feature_hits(layer)
elif resulttype == 'results':
LOGGER.debug('results specified')
result = self._response_feature_collection(
layer, limit, skip_geometry=skip_geometry)
else:
LOGGER.error('Invalid resulttype: %s' % resulttype)
except RuntimeError as err:
LOGGER.error(err)
raise ProviderQueryError(err)
except ProviderConnectionError as err:
LOGGER.error(err)
raise ProviderConnectionError(err)
except Exception as err:
LOGGER.error(err)
> raise ProviderGenericError(err)
E pygeoapi.provider.base.ProviderGenericError: Cannot open OGR Source: WFS:https://demo.geo-solutions.it/geoserver/wfs?
pygeoapi/provider/ogr.py:368: ProviderGenericError
-------------------------------------------------------------------------------- Captured log call --------------------------------------------------------------------------------
ERROR pygeoapi.provider.ogr:ogr.py:811 Error Number: 1, Type: Failure, Msg: HTTP error code : 503
ERROR pygeoapi.provider.ogr:ogr.py:223 Ignore errors during the connection for Driver WFS
ERROR pygeoapi.provider.ogr:ogr.py:230 Cannot open OGR Source: WFS:https://demo.geo-solutions.it/geoserver/wfs?
ERROR pygeoapi.provider.ogr:ogr.py:289 Cannot open OGR Source: WFS:https://demo.geo-solutions.it/geoserver/wfs?
ERROR pygeoapi.provider.ogr:ogr.py:811 Error Number: 1, Type: Failure, Msg: HTTP error code : 503
ERROR pygeoapi.provider.ogr:ogr.py:223 Ignore errors during the connection for Driver WFS
ERROR pygeoapi.provider.ogr:ogr.py:230 Cannot open OGR Source: WFS:https://demo.geo-solutions.it/geoserver/wfs?
ERROR pygeoapi.provider.ogr:ogr.py:367 Cannot open OGR Source: WFS:https://demo.geo-solutions.it/geoserver/wfs?
_________________________________________________________________________ test_query_bbox_hits_geosol_gs __________________________________________________________________________
self = <OGRProvider> {'source_type': 'WFS', 'source': 'WFS:https://demo.geo-solutions.it/geoserver/wfs?', 'source_srs': 'EPSG...e_options': {'OGR_WFS_LOAD_MULTIPLE_LAYER_DEFN': 'NO'}, 'gdal_ogr_options': {'GDAL_CACHEMAX': '64', 'CPL_DEBUG': 'NO'}}
offset = 0, limit = 10, resulttype = 'hits', bbox = (681417.0, 4849032.0, 681417.3, 4849032.3), datetime_ = None, properties = [], sortby = [], select_properties = []
skip_geometry = False, q = None, kwargs = {}, result = None
def query(self, offset=0, limit=10, resulttype='results',
bbox=[], datetime_=None, properties=[], sortby=[],
select_properties=[], skip_geometry=False, q=None, **kwargs):
"""
Query OGR source
:param offset: starting record to return (default 0)
:param limit: number of records to return (default 10)
:param resulttype: return results or hit limit (default results)
:param bbox: bounding box [minx,miny,maxx,maxy]
:param datetime_: temporal (datestamp or extent)
:param properties: list of tuples (name, value)
:param sortby: list of dicts (property, order)
:param select_properties: list of property names
:param skip_geometry: bool of whether to skip geometry (default False)
:param q: full-text search term(s)
:returns: dict of 0..n GeoJSON features
"""
result = None
try:
if self.source_capabilities['paging']:
self.source_helper.enable_paging(offset, limit)
> layer = self._get_layer()
pygeoapi/provider/ogr.py:320:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <OGRProvider> {'source_type': 'WFS', 'source': 'WFS:https://demo.geo-solutions.it/geoserver/wfs?', 'source_srs': 'EPSG...e_options': {'OGR_WFS_LOAD_MULTIPLE_LAYER_DEFN': 'NO'}, 'gdal_ogr_options': {'GDAL_CACHEMAX': '64', 'CPL_DEBUG': 'NO'}}
def _get_layer(self):
if not self.conn:
> self._open()
pygeoapi/provider/ogr.py:246:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <OGRProvider> {'source_type': 'WFS', 'source': 'WFS:https://demo.geo-solutions.it/geoserver/wfs?', 'source_srs': 'EPSG...e_options': {'OGR_WFS_LOAD_MULTIPLE_LAYER_DEFN': 'NO'}, 'gdal_ogr_options': {'GDAL_CACHEMAX': '64', 'CPL_DEBUG': 'NO'}}
def _open(self):
source_type = self.data_def['source_type']
self.driver = self.ogr.GetDriverByName(source_type)
if not self.driver:
msg = f'No Driver for Source: {source_type}'
LOGGER.error(msg)
raise Exception(msg)
if self.open_options:
try:
self.conn = self.gdal.OpenEx(
self.data_def['source'],
self.gdal.OF_VECTOR,
open_options=self._list_open_options())
except RuntimeError as err:
LOGGER.error(err)
raise ProviderConnectionError(err)
except Exception:
msg = f'Ignore errors during the connection for Driver {source_type}' # noqa
LOGGER.error(msg)
self.conn = _ignore_gdal_error(
self.gdal, 'OpenEx', self.data_def['source'],
self.gdal.OF_VECTOR,
open_options=self._list_open_options())
else:
try:
self.conn = self.driver.Open(self.data_def['source'], 0)
except RuntimeError as err:
LOGGER.error(err)
raise ProviderConnectionError(err)
except Exception:
msg = f'Ignore errors during the connection for Driver {source_type}' # noqa
LOGGER.error(msg)
# ignore errors for ESRIJSON not having geometry member
# see https://github.com/OSGeo/gdal/commit/38b0feed67f80ded32be6c508323d862e1a14474 # noqa
self.conn = _ignore_gdal_error(
self.driver, 'Open', self.data_def['source'], 0)
if not self.conn:
msg = 'Cannot open OGR Source: %s' % self.data_def['source']
LOGGER.error(msg)
> raise Exception(msg)
E Exception: Cannot open OGR Source: WFS:https://demo.geo-solutions.it/geoserver/wfs?
pygeoapi/provider/ogr.py:231: Exception
During handling of the above exception, another exception occurred:
config_geosol_gs_WFS = {'data': {'gdal_ogr_options': {'CPL_DEBUG': 'NO', 'GDAL_CACHEMAX': '64'}, 'source': 'WFS:https://demo.geo-solutions.it...R_WFS_LOAD_MULTIPLE_LAYER_DEFN': 'NO'}, ...}, 'id_field': 'gml_id', 'layer': 'unesco:Unesco_point', 'name': 'OGR', ...}
def test_query_bbox_hits_geosol_gs(config_geosol_gs_WFS):
"""Testing query for a valid JSON object with geometry, single address"""
p = OGRProvider(config_geosol_gs_WFS)
> feature_collection = p.query(
bbox=(681417.0, 4849032.0, 681417.3, 4849032.3), resulttype='hits')
tests/test_ogr_wfs_provider.py:330:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <OGRProvider> {'source_type': 'WFS', 'source': 'WFS:https://demo.geo-solutions.it/geoserver/wfs?', 'source_srs': 'EPSG...e_options': {'OGR_WFS_LOAD_MULTIPLE_LAYER_DEFN': 'NO'}, 'gdal_ogr_options': {'GDAL_CACHEMAX': '64', 'CPL_DEBUG': 'NO'}}
offset = 0, limit = 10, resulttype = 'hits', bbox = (681417.0, 4849032.0, 681417.3, 4849032.3), datetime_ = None, properties = [], sortby = [], select_properties = []
skip_geometry = False, q = None, kwargs = {}, result = None
def query(self, offset=0, limit=10, resulttype='results',
bbox=[], datetime_=None, properties=[], sortby=[],
select_properties=[], skip_geometry=False, q=None, **kwargs):
"""
Query OGR source
:param offset: starting record to return (default 0)
:param limit: number of records to return (default 10)
:param resulttype: return results or hit limit (default results)
:param bbox: bounding box [minx,miny,maxx,maxy]
:param datetime_: temporal (datestamp or extent)
:param properties: list of tuples (name, value)
:param sortby: list of dicts (property, order)
:param select_properties: list of property names
:param skip_geometry: bool of whether to skip geometry (default False)
:param q: full-text search term(s)
:returns: dict of 0..n GeoJSON features
"""
result = None
try:
if self.source_capabilities['paging']:
self.source_helper.enable_paging(offset, limit)
layer = self._get_layer()
if bbox:
LOGGER.debug('processing bbox parameter')
minx, miny, maxx, maxy = [float(b) for b in bbox]
wkt = f"POLYGON (({minx} {miny},{minx} {maxy},{maxx} {maxy}," \
f"{maxx} {miny},{minx} {miny}))"
polygon = self.ogr.CreateGeometryFromWkt(wkt)
if self.transform_in:
polygon.Transform(self.transform_in)
layer.SetSpatialFilter(polygon)
# layer.SetSpatialFilterRect(
# float(minx), float(miny), float(maxx), float(maxy))
if properties:
LOGGER.debug('processing properties')
attribute_filter = ' and '.join(
map(lambda x: f'{x[0]} = \'{x[1]}\'', properties)
)
LOGGER.debug(attribute_filter)
layer.SetAttributeFilter(attribute_filter)
# Make response based on resulttype specified
if resulttype == 'hits':
LOGGER.debug('hits only specified')
result = self._response_feature_hits(layer)
elif resulttype == 'results':
LOGGER.debug('results specified')
result = self._response_feature_collection(
layer, limit, skip_geometry=skip_geometry)
else:
LOGGER.error('Invalid resulttype: %s' % resulttype)
except RuntimeError as err:
LOGGER.error(err)
raise ProviderQueryError(err)
except ProviderConnectionError as err:
LOGGER.error(err)
raise ProviderConnectionError(err)
except Exception as err:
LOGGER.error(err)
> raise ProviderGenericError(err)
E pygeoapi.provider.base.ProviderGenericError: Cannot open OGR Source: WFS:https://demo.geo-solutions.it/geoserver/wfs?
pygeoapi/provider/ogr.py:368: ProviderGenericError
-------------------------------------------------------------------------------- Captured log call --------------------------------------------------------------------------------
ERROR pygeoapi.provider.ogr:ogr.py:811 Error Number: 1, Type: Failure, Msg: HTTP error code : 503
ERROR pygeoapi.provider.ogr:ogr.py:223 Ignore errors during the connection for Driver WFS
ERROR pygeoapi.provider.ogr:ogr.py:230 Cannot open OGR Source: WFS:https://demo.geo-solutions.it/geoserver/wfs?
ERROR pygeoapi.provider.ogr:ogr.py:289 Cannot open OGR Source: WFS:https://demo.geo-solutions.it/geoserver/wfs?
ERROR pygeoapi.provider.ogr:ogr.py:811 Error Number: 1, Type: Failure, Msg: HTTP error code : 503
ERROR pygeoapi.provider.ogr:ogr.py:223 Ignore errors during the connection for Driver WFS
ERROR pygeoapi.provider.ogr:ogr.py:230 Cannot open OGR Source: WFS:https://demo.geo-solutions.it/geoserver/wfs?
ERROR pygeoapi.provider.ogr:ogr.py:367 Cannot open OGR Source: WFS:https://demo.geo-solutions.it/geoserver/wfs?
____________________________________________________________________________ test_query_bbox_geosol_gs ____________________________________________________________________________
self = <OGRProvider> {'source_type': 'WFS', 'source': 'WFS:https://demo.geo-solutions.it/geoserver/wfs?', 'source_srs': 'EPSG...e_options': {'OGR_WFS_LOAD_MULTIPLE_LAYER_DEFN': 'NO'}, 'gdal_ogr_options': {'GDAL_CACHEMAX': '64', 'CPL_DEBUG': 'NO'}}
offset = 0, limit = 10, resulttype = 'results', bbox = (681417.0, 4849032.0, 681417.3, 4849032.3), datetime_ = None, properties = [], sortby = [], select_properties = []
skip_geometry = False, q = None, kwargs = {}, result = None
def query(self, offset=0, limit=10, resulttype='results',
bbox=[], datetime_=None, properties=[], sortby=[],
select_properties=[], skip_geometry=False, q=None, **kwargs):
"""
Query OGR source
:param offset: starting record to return (default 0)
:param limit: number of records to return (default 10)
:param resulttype: return results or hit limit (default results)
:param bbox: bounding box [minx,miny,maxx,maxy]
:param datetime_: temporal (datestamp or extent)
:param properties: list of tuples (name, value)
:param sortby: list of dicts (property, order)
:param select_properties: list of property names
:param skip_geometry: bool of whether to skip geometry (default False)
:param q: full-text search term(s)
:returns: dict of 0..n GeoJSON features
"""
result = None
try:
if self.source_capabilities['paging']:
self.source_helper.enable_paging(offset, limit)
> layer = self._get_layer()
pygeoapi/provider/ogr.py:320:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <OGRProvider> {'source_type': 'WFS', 'source': 'WFS:https://demo.geo-solutions.it/geoserver/wfs?', 'source_srs': 'EPSG...e_options': {'OGR_WFS_LOAD_MULTIPLE_LAYER_DEFN': 'NO'}, 'gdal_ogr_options': {'GDAL_CACHEMAX': '64', 'CPL_DEBUG': 'NO'}}
def _get_layer(self):
if not self.conn:
> self._open()
pygeoapi/provider/ogr.py:246:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <OGRProvider> {'source_type': 'WFS', 'source': 'WFS:https://demo.geo-solutions.it/geoserver/wfs?', 'source_srs': 'EPSG...e_options': {'OGR_WFS_LOAD_MULTIPLE_LAYER_DEFN': 'NO'}, 'gdal_ogr_options': {'GDAL_CACHEMAX': '64', 'CPL_DEBUG': 'NO'}}
def _open(self):
source_type = self.data_def['source_type']
self.driver = self.ogr.GetDriverByName(source_type)
if not self.driver:
msg = f'No Driver for Source: {source_type}'
LOGGER.error(msg)
raise Exception(msg)
if self.open_options:
try:
self.conn = self.gdal.OpenEx(
self.data_def['source'],
self.gdal.OF_VECTOR,
open_options=self._list_open_options())
except RuntimeError as err:
LOGGER.error(err)
raise ProviderConnectionError(err)
except Exception:
msg = f'Ignore errors during the connection for Driver {source_type}' # noqa
LOGGER.error(msg)
self.conn = _ignore_gdal_error(
self.gdal, 'OpenEx', self.data_def['source'],
self.gdal.OF_VECTOR,
open_options=self._list_open_options())
else:
try:
self.conn = self.driver.Open(self.data_def['source'], 0)
except RuntimeError as err:
LOGGER.error(err)
raise ProviderConnectionError(err)
except Exception:
msg = f'Ignore errors during the connection for Driver {source_type}' # noqa
LOGGER.error(msg)
# ignore errors for ESRIJSON not having geometry member
# see https://github.com/OSGeo/gdal/commit/38b0feed67f80ded32be6c508323d862e1a14474 # noqa
self.conn = _ignore_gdal_error(
self.driver, 'Open', self.data_def['source'], 0)
if not self.conn:
msg = 'Cannot open OGR Source: %s' % self.data_def['source']
LOGGER.error(msg)
> raise Exception(msg)
E Exception: Cannot open OGR Source: WFS:https://demo.geo-solutions.it/geoserver/wfs?
pygeoapi/provider/ogr.py:231: Exception
During handling of the above exception, another exception occurred:
config_geosol_gs_WFS = {'data': {'gdal_ogr_options': {'CPL_DEBUG': 'NO', 'GDAL_CACHEMAX': '64'}, 'source': 'WFS:https://demo.geo-solutions.it...R_WFS_LOAD_MULTIPLE_LAYER_DEFN': 'NO'}, ...}, 'id_field': 'gml_id', 'layer': 'unesco:Unesco_point', 'name': 'OGR', ...}
def test_query_bbox_geosol_gs(config_geosol_gs_WFS):
"""Testing query for a valid JSON object with geometry"""
p = OGRProvider(config_geosol_gs_WFS)
# feature_collection = p.query(
# bbox=[120000, 480000, 124000, 487000], resulttype='results')
> feature_collection = p.query(
bbox=(681417.0, 4849032.0, 681417.3, 4849032.3),
resulttype='results')
tests/test_ogr_wfs_provider.py:388:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <OGRProvider> {'source_type': 'WFS', 'source': 'WFS:https://demo.geo-solutions.it/geoserver/wfs?', 'source_srs': 'EPSG...e_options': {'OGR_WFS_LOAD_MULTIPLE_LAYER_DEFN': 'NO'}, 'gdal_ogr_options': {'GDAL_CACHEMAX': '64', 'CPL_DEBUG': 'NO'}}
offset = 0, limit = 10, resulttype = 'results', bbox = (681417.0, 4849032.0, 681417.3, 4849032.3), datetime_ = None, properties = [], sortby = [], select_properties = []
skip_geometry = False, q = None, kwargs = {}, result = None
def query(self, offset=0, limit=10, resulttype='results',
bbox=[], datetime_=None, properties=[], sortby=[],
select_properties=[], skip_geometry=False, q=None, **kwargs):
"""
Query OGR source
:param offset: starting record to return (default 0)
:param limit: number of records to return (default 10)
:param resulttype: return results or hit limit (default results)
:param bbox: bounding box [minx,miny,maxx,maxy]
:param datetime_: temporal (datestamp or extent)
:param properties: list of tuples (name, value)
:param sortby: list of dicts (property, order)
:param select_properties: list of property names
:param skip_geometry: bool of whether to skip geometry (default False)
:param q: full-text search term(s)
:returns: dict of 0..n GeoJSON features
"""
result = None
try:
if self.source_capabilities['paging']:
self.source_helper.enable_paging(offset, limit)
layer = self._get_layer()
if bbox:
LOGGER.debug('processing bbox parameter')
minx, miny, maxx, maxy = [float(b) for b in bbox]
wkt = f"POLYGON (({minx} {miny},{minx} {maxy},{maxx} {maxy}," \
f"{maxx} {miny},{minx} {miny}))"
polygon = self.ogr.CreateGeometryFromWkt(wkt)
if self.transform_in:
polygon.Transform(self.transform_in)
layer.SetSpatialFilter(polygon)
# layer.SetSpatialFilterRect(
# float(minx), float(miny), float(maxx), float(maxy))
if properties:
LOGGER.debug('processing properties')
attribute_filter = ' and '.join(
map(lambda x: f'{x[0]} = \'{x[1]}\'', properties)
)
LOGGER.debug(attribute_filter)
layer.SetAttributeFilter(attribute_filter)
# Make response based on resulttype specified
if resulttype == 'hits':
LOGGER.debug('hits only specified')
result = self._response_feature_hits(layer)
elif resulttype == 'results':
LOGGER.debug('results specified')
result = self._response_feature_collection(
layer, limit, skip_geometry=skip_geometry)
else:
LOGGER.error('Invalid resulttype: %s' % resulttype)
except RuntimeError as err:
LOGGER.error(err)
raise ProviderQueryError(err)
except ProviderConnectionError as err:
LOGGER.error(err)
raise ProviderConnectionError(err)
except Exception as err:
LOGGER.error(err)
> raise ProviderGenericError(err)
E pygeoapi.provider.base.ProviderGenericError: Cannot open OGR Source: WFS:https://demo.geo-solutions.it/geoserver/wfs?
pygeoapi/provider/ogr.py:368: ProviderGenericError
-------------------------------------------------------------------------------- Captured log call --------------------------------------------------------------------------------
ERROR pygeoapi.provider.ogr:ogr.py:811 Error Number: 1, Type: Failure, Msg: HTTP error code : 503
ERROR pygeoapi.provider.ogr:ogr.py:223 Ignore errors during the connection for Driver WFS
ERROR pygeoapi.provider.ogr:ogr.py:230 Cannot open OGR Source: WFS:https://demo.geo-solutions.it/geoserver/wfs?
ERROR pygeoapi.provider.ogr:ogr.py:289 Cannot open OGR Source: WFS:https://demo.geo-solutions.it/geoserver/wfs?
ERROR pygeoapi.provider.ogr:ogr.py:811 Error Number: 1, Type: Failure, Msg: HTTP error code : 503
ERROR pygeoapi.provider.ogr:ogr.py:223 Ignore errors during the connection for Driver WFS
ERROR pygeoapi.provider.ogr:ogr.py:230 Cannot open OGR Source: WFS:https://demo.geo-solutions.it/geoserver/wfs?
ERROR pygeoapi.provider.ogr:ogr.py:367 Cannot open OGR Source: WFS:https://demo.geo-solutions.it/geoserver/wfs?
================================================================================ warnings summary =================================================================================
../usr/lib/python3/dist-packages/_pytest/config/__init__.py:1233
/usr/lib/python3/dist-packages/_pytest/config/__init__.py:1233: PytestConfigWarning: Unknown config option: env
self._warn_or_fail_if_strict(f"Unknown config option: {key}\n")
-- Docs: https://docs.pytest.org/en/stable/warnings.html
============================================================================= short test summary info =============================================================================
FAILED tests/test_ogr_wfs_provider.py::test_get_geosol_gs - pygeoapi.provider.base.ProviderGenericError: Cannot open OGR Source: WFS:https://demo.geo-solutions.it/geoserver/wfs?
FAILED tests/test_ogr_wfs_provider.py::test_query_hits_geosol_gs - pygeoapi.provider.base.ProviderGenericError: Cannot open OGR Source: WFS:https://demo.geo-solutions.it/geoser...
FAILED tests/test_ogr_wfs_provider.py::test_query_bbox_hits_geosol_gs - pygeoapi.provider.base.ProviderGenericError: Cannot open OGR Source: WFS:https://demo.geo-solutions.it/g...
FAILED tests/test_ogr_wfs_provider.py::test_query_bbox_geosol_gs - pygeoapi.provider.base.ProviderGenericError: Cannot open OGR Source: WFS:https://demo.geo-solutions.it/geoser...
=============================================================== 4 failed, 17 passed, 1 warning in 70.07s (0:01:10) ================================================================
=============================================================================== test session starts ===============================================================================
platform linux -- Python 3.10.6, pytest-6.2.5, py-1.10.0, pluggy-0.13.0
rootdir: /pygeoapi, configfile: pytest.ini
collected 4 items
tests/test_openapi.py .... [100%]
================================================================================ warnings summary =================================================================================
../usr/lib/python3/dist-packages/_pytest/config/__init__.py:1233
/usr/lib/python3/dist-packages/_pytest/config/__init__.py:1233: PytestConfigWarning: Unknown config option: env
self._warn_or_fail_if_strict(f"Unknown config option: {key}\n")
tests/test_openapi.py::test_get_oas
<frozen importlib._bootstrap>:241: RuntimeWarning: numpy.ndarray size changed, may indicate binary incompatibility. Expected 16 from C header, got 88 from PyObject
tests/test_openapi.py::test_get_oas
/usr/lib/python3/dist-packages/xarray/backends/plugins.py:105: DeprecationWarning: SelectableGroups dict interface is deprecated. Use select.
entrypoints = entry_points().get("xarray.backends", ())
-- Docs: https://docs.pytest.org/en/stable/warnings.html
========================================================================== 4 passed, 3 warnings in 1.58s ==========================================================================
Skipping: tests/test_postgresql_provider.py
=============================================================================== test session starts ===============================================================================
platform linux -- Python 3.10.6, pytest-6.2.5, py-1.10.0, pluggy-0.13.0
rootdir: /pygeoapi, configfile: pytest.ini
collected 5 items
tests/test_rasterio_provider.py ..... [100%]
================================================================================ warnings summary =================================================================================
../usr/lib/python3/dist-packages/_pytest/config/__init__.py:1233
/usr/lib/python3/dist-packages/_pytest/config/__init__.py:1233: PytestConfigWarning: Unknown config option: env
self._warn_or_fail_if_strict(f"Unknown config option: {key}\n")
-- Docs: https://docs.pytest.org/en/stable/warnings.html
========================================================================== 5 passed, 1 warning in 1.31s ===========================================================================
Skipping: tests/test_sensorthings_provider.py
=============================================================================== test session starts ===============================================================================
platform linux -- Python 3.10.6, pytest-6.2.5, py-1.10.0, pluggy-0.13.0
rootdir: /pygeoapi, configfile: pytest.ini
collected 5 items
tests/test_socrata_provider.py ..... [100%]
================================================================================ warnings summary =================================================================================
../usr/lib/python3/dist-packages/_pytest/config/__init__.py:1233
/usr/lib/python3/dist-packages/_pytest/config/__init__.py:1233: PytestConfigWarning: Unknown config option: env
self._warn_or_fail_if_strict(f"Unknown config option: {key}\n")
-- Docs: https://docs.pytest.org/en/stable/warnings.html
========================================================================== 5 passed, 1 warning in 16.44s ==========================================================================
=============================================================================== test session starts ===============================================================================
platform linux -- Python 3.10.6, pytest-6.2.5, py-1.10.0, pluggy-0.13.0
rootdir: /pygeoapi, configfile: pytest.ini
collected 11 items
tests/test_sqlite_geopackage_provider.py ........... [100%]
================================================================================ warnings summary =================================================================================
../usr/lib/python3/dist-packages/_pytest/config/__init__.py:1233
/usr/lib/python3/dist-packages/_pytest/config/__init__.py:1233: PytestConfigWarning: Unknown config option: env
self._warn_or_fail_if_strict(f"Unknown config option: {key}\n")
-- Docs: https://docs.pytest.org/en/stable/warnings.html
========================================================================== 11 passed, 1 warning in 0.71s ==========================================================================
=============================================================================== test session starts ===============================================================================
platform linux -- Python 3.10.6, pytest-6.2.5, py-1.10.0, pluggy-0.13.0
rootdir: /pygeoapi, configfile: pytest.ini
collected 4 items
tests/test_tinydb_catalogue_provider.py .... [100%]
================================================================================ warnings summary =================================================================================
../usr/lib/python3/dist-packages/_pytest/config/__init__.py:1233
/usr/lib/python3/dist-packages/_pytest/config/__init__.py:1233: PytestConfigWarning: Unknown config option: env
self._warn_or_fail_if_strict(f"Unknown config option: {key}\n")
-- Docs: https://docs.pytest.org/en/stable/warnings.html
========================================================================== 4 passed, 1 warning in 0.43s ===========================================================================
=============================================================================== test session starts ===============================================================================
platform linux -- Python 3.10.6, pytest-6.2.5, py-1.10.0, pluggy-0.13.0
rootdir: /pygeoapi, configfile: pytest.ini
collected 1 item
tests/test_tinydb_manager_for_parallel_requests.py F [100%]
==================================================================================== FAILURES =====================================================================================
_____________________________________________________________________ test_async_hello_world_process_parallel _____________________________________________________________________
api_ = <pygeoapi.api.API object at 0x7f8eef0901c0>
config = {'logging': {'level': 'DEBUG'}, 'metadata': {'contact': {'address': 'Mailing Address', 'city': 'City', 'country': 'Cou....}, ...}, 'server': {'bind': {'host': '0.0.0.0', 'port': 5000}, 'cors': True, 'encoding': 'utf-8', 'gzip': False, ...}}
def test_async_hello_world_process_parallel(api_, config):
index_name = Path(config['server']['manager']['connection'])
if index_name.exists():
index_name.unlink()
NUM_PROCS = 4
process_id = "hello-world"
req = _create_request("World", "Hello", api_.locales)
manager = Manager()
processes_out = manager.dict()
procs = []
for i in range(0, NUM_PROCS):
procs.append(Process(target=_execute_process,
args=(api_, req, process_id, i, processes_out)))
# Run processes in parallel
procs_started = []
for p in procs:
p.start()
procs_started.append(p)
for p in procs_started:
# let main process wait until sub-processes completed
p.join()
# Test if jobs are registered and run correctly
> db = TinyDB(index_name)
tests/test_tinydb_manager_for_parallel_requests.py:111:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3/dist-packages/tinydb/database.py:167: in __init__
self._table = self.table(default_table)
/usr/lib/python3/dist-packages/tinydb/database.py:202: in table
table = table_class(self._cls_storage_proxy(self._storage, name), name,
/usr/lib/python3/dist-packages/tinydb/database.py:309: in __init__
data = self._read()
/usr/lib/python3/dist-packages/tinydb/database.py:411: in _read
return self._storage.read()
/usr/lib/python3/dist-packages/tinydb/database.py:90: in read
raw_data = self._storage.read() or {}
/usr/lib/python3/dist-packages/tinydb/storages.py:116: in read
return json.load(self._handle)
/usr/lib/python3.10/json/__init__.py:293: in load
return loads(fp.read(),
/usr/lib/python3.10/json/__init__.py:346: in loads
return _default_decoder.decode(s)
/usr/lib/python3.10/json/decoder.py:337: in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <json.decoder.JSONDecoder object at 0x7f8f30b979a0>, s = '{"_default": {"1', idx = 0
def raw_decode(self, s, idx=0):
"""Decode a JSON document from ``s`` (a ``str`` beginning with
a JSON document) and return a 2-tuple of the Python
representation and the index in ``s`` where the document ended.
This can be used to decode a JSON document from a string that may
have extraneous data at the end.
"""
try:
> obj, end = self.scan_once(s, idx)
E json.decoder.JSONDecodeError: Unterminated string starting at: line 1 column 15 (char 14)
/usr/lib/python3.10/json/decoder.py:353: JSONDecodeError
================================================================================ warnings summary =================================================================================
../usr/lib/python3/dist-packages/_pytest/config/__init__.py:1233
/usr/lib/python3/dist-packages/_pytest/config/__init__.py:1233: PytestConfigWarning: Unknown config option: env
self._warn_or_fail_if_strict(f"Unknown config option: {key}\n")
-- Docs: https://docs.pytest.org/en/stable/warnings.html
============================================================================= short test summary info =============================================================================
FAILED tests/test_tinydb_manager_for_parallel_requests.py::test_async_hello_world_process_parallel - json.decoder.JSONDecodeError: Unterminated string starting at: line 1 colum...
========================================================================== 1 failed, 1 warning in 1.44s ===========================================================================
=============================================================================== test session starts ===============================================================================
platform linux -- Python 3.10.6, pytest-6.2.5, py-1.10.0, pluggy-0.13.0
rootdir: /pygeoapi, configfile: pytest.ini
collected 11 items
tests/test_util.py ........... [100%]
================================================================================ warnings summary =================================================================================
../usr/lib/python3/dist-packages/_pytest/config/__init__.py:1233
/usr/lib/python3/dist-packages/_pytest/config/__init__.py:1233: PytestConfigWarning: Unknown config option: env
self._warn_or_fail_if_strict(f"Unknown config option: {key}\n")
-- Docs: https://docs.pytest.org/en/stable/warnings.html
========================================================================== 11 passed, 1 warning in 0.62s ==========================================================================
=============================================================================== test session starts ===============================================================================
platform linux -- Python 3.10.6, pytest-6.2.5, py-1.10.0, pluggy-0.13.0
rootdir: /pygeoapi, configfile: pytest.ini
collected 4 items
tests/test_xarray_netcdf_provider.py .... [100%]
================================================================================ warnings summary =================================================================================
../usr/lib/python3/dist-packages/_pytest/config/__init__.py:1233
/usr/lib/python3/dist-packages/_pytest/config/__init__.py:1233: PytestConfigWarning: Unknown config option: env
self._warn_or_fail_if_strict(f"Unknown config option: {key}\n")
tests/test_xarray_netcdf_provider.py::test_provider
/usr/lib/python3/dist-packages/xarray/backends/plugins.py:105: DeprecationWarning: SelectableGroups dict interface is deprecated. Use select.
entrypoints = entry_points().get("xarray.backends", ())
-- Docs: https://docs.pytest.org/en/stable/warnings.html
========================================================================== 4 passed, 2 warnings in 1.28s ==========================================================================
=============================================================================== test session starts ===============================================================================
platform linux -- Python 3.10.6, pytest-6.2.5, py-1.10.0, pluggy-0.13.0
rootdir: /pygeoapi, configfile: pytest.ini
collected 5 items
tests/test_xarray_zarr_provider.py ..... [100%]
================================================================================ warnings summary =================================================================================
../usr/lib/python3/dist-packages/_pytest/config/__init__.py:1233
/usr/lib/python3/dist-packages/_pytest/config/__init__.py:1233: PytestConfigWarning: Unknown config option: env
self._warn_or_fail_if_strict(f"Unknown config option: {key}\n")
tests/test_xarray_zarr_provider.py::test_provider
/usr/lib/python3/dist-packages/xarray/backends/plugins.py:105: DeprecationWarning: SelectableGroups dict interface is deprecated. Use select.
entrypoints = entry_points().get("xarray.backends", ())
tests/test_xarray_zarr_provider.py::test_provider
tests/test_xarray_zarr_provider.py::test_domainset
tests/test_xarray_zarr_provider.py::test_rangetype
tests/test_xarray_zarr_provider.py::test_query
/pygeoapi/pygeoapi/provider/xarray_.py:66: RuntimeWarning: Failed to open Zarr store with consolidated metadata, falling back to try reading non-consolidated metadata. This is typically much slower for opening a dataset. To silence this warning, consider:
1. Consolidating metadata in this existing store with zarr.consolidate_metadata().
2. Explicitly setting consolidated=False, to avoid trying to read consolidate metadata, or
3. Explicitly setting consolidated=True, to raise an error in this case instead of falling back to try reading non-consolidated metadata.
self._data = open_func(self.data)
-- Docs: https://docs.pytest.org/en/stable/warnings.html
========================================================================== 5 passed, 6 warnings in 1.42s ==========================================================================
END /entrypoint.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment