pygeoapi
pygeoapi copied to clipboard
Exception thrown when loading Natural Earth GeoPackage.
Description When starting the Docker image with a configuration pointing to a GeoPackage from Natural Earth, an exception is thrown when the OpenAPI schema is generated.
Steps to Reproduce
Run from standard Docker image, with .gpkg linked above in data directory.
Relevant config section:
resources:
coastlines:
type: collection
title: Coastlines
description: Worldwide Coastlines
keywords:
- ocean
- coast
links:
- type: application/geopackage+sqlite3
rel: canonical
title: source
href: http://naciscdn.org/naturalearth/packages/natural_earth_vector.gpkg.zip
hreflang: en-US
extents:
spatial:
bbox: [-180,-90,180,90]
crs: http://www.opengis.net/def/crs/OGC/1.3/CRS84
providers:
- type: feature
name: SQLiteGPKG
data: data/natural_earth_vector.gpkg
table: 'ne_10m_coastline'
id_field: fid
Expected behavior Successful creation of the OpenAPI document, and successful startup of the server.
Screenshots/Tracebacks
pygeoapi generate-openapi-document -c ${PYGEOAPI_CONFIG} > ${PYGEOAPI_OPENAPI}
DEBUG:pygeoapi.openapi:setting up server info
DEBUG:pygeoapi.openapi:setting up datasets
DEBUG:pygeoapi.openapi:setting up collection endpoints
DEBUG:pygeoapi.util:Searching for provider type feature
DEBUG:pygeoapi.plugin:Plugins: {'CSV': 'pygeoapi.provider.csv_.CSVProvider', 'Elasticsearch': 'pygeoapi.provider.elasticsearch_.ElasticsearchProvider', 'ElasticsearchCatalogue': 'pygeoapi.provider.elasticsearch_.ElasticsearchCatalogueProvider', 'GeoJSON': 'pygeoapi.provider.geojson.GeoJSONProvider', 'OGR': 'pygeoapi.provider.ogr.OGRProvider', 'PostgreSQL': 'pygeoapi.provider.postgresql.PostgreSQLProvider', 'SQLiteGPKG': 'pygeoapi.provider.sqlite.SQLiteGPKGProvider', 'MongoDB': 'pygeoapi.provider.mongo.MongoProvider', 'FileSystem': 'pygeoapi.provider.filesystem.FileSystemProvider', 'rasterio': 'pygeoapi.provider.rasterio_.RasterioProvider', 'xarray': 'pygeoapi.provider.xarray_.XarrayProvider', 'MVT': 'pygeoapi.provider.mvt.MVTProvider', 'TinyDBCatalogue': 'pygeoapi.provider.tinydb_.TinyDBCatalogueProvider', 'xarray-edr': 'pygeoapi.provider.xarray_edr.XarrayEDRProvider'}
DEBUG:pygeoapi.plugin:package name: pygeoapi.provider.sqlite
DEBUG:pygeoapi.plugin:class name: SQLiteGPKGProvider
DEBUG:pygeoapi.provider.sqlite:Setting SQLite properties:
DEBUG:pygeoapi.provider.sqlite:Data source: data/natural_earth_vector.gpkg
DEBUG:pygeoapi.provider.sqlite:Name: SQLiteGPKG
DEBUG:pygeoapi.provider.sqlite:ID_field: fid
DEBUG:pygeoapi.provider.sqlite:Table: ne_10m_coastline
INFO:pygeoapi.provider.sqlite:Detected GPKG 1.0 or 1.1
INFO:pygeoapi.provider.sqlite:SELECT AutoGPKGStart() returned 0.Detected GPKG but couldnt load support
Traceback (most recent call last):
File "/usr/local/bin/pygeoapi", line 12, in <module>
load_entry_point('pygeoapi', 'console_scripts', 'pygeoapi')()
File "/usr/lib/python3/dist-packages/click/core.py", line 764, in __call__
return self.main(*args, **kwargs)
File "/usr/lib/python3/dist-packages/click/core.py", line 717, in main
rv = self.invoke(ctx)
File "/usr/lib/python3/dist-packages/click/core.py", line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/lib/python3/dist-packages/click/core.py", line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/lib/python3/dist-packages/click/core.py", line 555, in invoke
return callback(*args, **kwargs)
File "/usr/lib/python3/dist-packages/click/decorators.py", line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File "/pygeoapi/pygeoapi/openapi.py", line 1003, in generate_openapi_document
click.echo(yaml.safe_dump(get_oas(s), default_flow_style=False))
File "/pygeoapi/pygeoapi/openapi.py", line 984, in get_oas
return get_oas_30(cfg)
File "/pygeoapi/pygeoapi/openapi.py", line 421, in get_oas_30
p = load_plugin('provider', get_provider_by_type(
File "/pygeoapi/pygeoapi/plugin.py", line 104, in load_plugin
plugin = class_(plugin_def)
File "/pygeoapi/pygeoapi/provider/sqlite.py", line 76, in __init__
self.cursor = self.__load()
File "/pygeoapi/pygeoapi/provider/sqlite.py", line 220, in __load
raise InvalidPluginError
pygeoapi.plugin.InvalidPluginError
Environment
- OS:
Linux 45a869325ca5 5.10.25-linuxkit #1 SMP Tue Mar 23 09:27:39 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux - Python version:
Python 3.8.5 (default, Jan 27 2021, 15:41:15) - pygeoapi version: 0.10.1
Additional context
I enabled DEBUG log level in via the launcher script, because the level set in the config was not being respected in the openapi generation entrypoint.
Addendum:
When I open the .gpkg file with a shell in the Docker container, I'm able to manually follow the steps:
sqlite> SELECT load_extension('mod_spatialite.so');
sqlite> PRAGMA application_id;
1196437808
sqlite> SELECT AutoGPKGStart();
58
Sorry for the delay and thanks for the report. Can you provide a working path to the NE test data?
I can reproduce it with filename.zip dataset and the following config:
providers:
- type: feature
name: SQLiteGPKG
data: filename.gpkg
id_field: fid
table: filename
https://user-images.githubusercontent.com/866124/188993949-4556ebef-c252-457c-a334-2087be2e1b5c.mp4
As per RFC4, this Issue has been inactive for 90 days. In order to manage maintenance burden, it will be automatically closed in 7 days.
As per RFC4, this Issue has been closed due to there being no activity for more than 90 days.