From 736987f51d4558a724fb9e28bda3befeb93305d8 Mon Sep 17 00:00:00 2001 From: Benjamin Webb <40066515+webb-ben@users.noreply.github.com> Date: Thu, 13 Jul 2023 12:15:16 -0400 Subject: [PATCH] Make intersect geom_field optional (#4) * Make geom_field optional * Fix flake8 --- pygeoapi_plugins/process/intersect.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pygeoapi_plugins/process/intersect.py b/pygeoapi_plugins/process/intersect.py index 9db1124..7bd6bfc 100644 --- a/pygeoapi_plugins/process/intersect.py +++ b/pygeoapi_plugins/process/intersect.py @@ -170,7 +170,7 @@ def execute(self, data): if not data.get('url') or not data.get('collection'): raise ProcessorExecuteError(f'Invalid input: {data.items()}') feature_url = data['url'] - geom_field = data['geom_field'] + geom_field = data.get('geom_field') collection = data['collection'] LOGGER.debug(f'Fetching {feature_url}') @@ -190,6 +190,9 @@ def execute(self, data): LOGGER.debug(f'Using geom from configuration: {geom_field}') else: LOGGER.debug(f'Using provided geom field: {geom_field}') + if not geom_field: + msg = f'Invalid geom_field: {data.items()}' + raise ProcessorExecuteError(msg) LOGGER.debug(f'Intesecting {cname} with backend {provider}') outputs = self._intersect(feature, geom_field, provider)