You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
'description': f'Collection {e} is not a supported Collection base name. The name must not include a version suffix. Please refer to the documentation for a list of supported Collections.',
message=f'Collection {e} is not a supported Collection base name. The name must not include a version suffix. Please refer to the documentation for a list of supported Collections.',
collection (str) - the feature collection to call from. Feature collection names and details can be found at https://api.os.uk/features/ngd/ofa/v1/collections/
279
-
params (dict, optional) - parameters to pass to the query as query parameters, supplied in a dictionary. Supported parameters are: bbox, bbox-crs, crs, datetime, filter, filter-crs, filter-lang, limit, offset
275
+
collection (str) - The feature collection to call from. Feature collection names and details can be found at https://api.os.uk/features/ngd/ofa/v1/collections/
276
+
params (dict, optional) - Parameters to pass to the API request as query parameters, supplied in a dictionary. Supported parameters are: bbox, bbox-crs, crs, datetime, filter, filter-crs, filter-lang, limit, offset. Find details of these API parameters on the OS technical docs: https://docs.os.uk/osngd/getting-started/access-the-os-ngd-api/os-ngd-api-features/technical-specification/features#get-collections-collectionid-items.
280
277
filter_params (dict, optional) - OS NGD attribute filters to pass to the query within the 'filter' query_param. The can be used instead of or in addition to manually setting the filter in params.
281
278
The key-value pairs will appended using the EQUAL TO [ = ] comparator. Any other CQL Operator comparisons must be set manually in params.
282
279
Queryable attributes can be found in OS NGD codelists documentation https://docs.os.uk/osngd/code-lists/code-lists-overview, or by inserting the relevant collectionId into the https://api.os.uk/features/ngd/ofa/v1/collections/{{collectionId}}/queryables endpoint.
283
280
wkt (string or shapely geometry object) - A means of searching a geometry for features. The search area(s) must be supplied in wkt, either in a string or as a Shapely geometry object.
284
281
The function automatically composes the full INTERSECTS filter and adds it to the 'filter' query parameter.
285
282
Make sure that 'filter-crs' is set to the appropriate value.
283
+
authenticate (boolean, default True) - If True, the request is authenticated using OAuth2. This requires the CLIENT_ID and CLIENT_SECRET environment variables to be set.
284
+
If False, no authentication is used, and an API key must be supplied in either the headers or params.
285
+
log_request_details (boolean, default True) - If True, adds extra logging for the request details. This can be used for telemetry when deployed as an API.
286
286
use_latest_collection (boolean, default False) - If True, it ensures that if a specific version of a collection is not supplied (eg. bld-fts-building[-2]), the latest version is used.
287
287
Note that if use_latest_collection but 'collection' does specify a version, the specified version is always used regardless of use_latest_collection.
288
288
headers (dict, optional) - Headers to pass to the query. These can include bearer-token authentication.
289
-
access_token (str) - An access token, which will be added as bearer token to the headers.
290
-
**kwargs: other generic parameters to be passed to the requests.get()
289
+
**kwargs - other parameters to be passed to the request.Session.request get method eg. headers, timeout.
291
290
292
291
Returns the features as a geojson, as per the OS NGD API.
293
292
'''
@@ -370,12 +369,15 @@ def wrapper(
370
369
371
370
params=params.copy() ifparamselse {}
372
371
372
+
if'limit'inparams:
373
+
returnconstruct_error_response(
374
+
message="With this Catalyst wrapper, the limit must be supplied as a function parameter and not as a key-value pair in params.",
375
+
)
376
+
373
377
if'offset'inparams:
374
-
return {
375
-
'code': 400,
376
-
'description': "'offset' is not a valid attribute for functions using this Catalyst wrapper.",
377
-
'errorSource': 'Catalyst Wrapper'
378
-
}
378
+
returnconstruct_error_response(
379
+
message="'offset' is not a valid attribute for functions using this Catalyst wrapper.",
380
+
)
379
381
380
382
features= []
381
383
@@ -385,11 +387,9 @@ def wrapper(
385
387
offset=0
386
388
387
389
ifnotlimitandnotrequest_limit:
388
-
return {
389
-
'code': 400,
390
-
'description': 'At least one of limit or request_limit must be provided to prevent indefinitely numerous requests and high costs.',
391
-
'errorSource': 'Catalyst Wrapper'
392
-
}
390
+
returnconstruct_error_response(
391
+
message='At least one of limit or request_limit must be provided to prevent indefinitely numerous requests and high costs.'
392
+
)
393
393
394
394
while (request_count!=request_limit) and (not (limit) oroffset<limit):
0 commit comments