|
| 1 | +--- |
| 2 | +title: RFC5 - Enhanced data limit handling |
| 3 | +--- |
| 4 | + |
| 5 | +# RFC5 - Enhanced data limit handling |
| 6 | + |
| 7 | +- date: 2024-11-19 |
| 8 | +- author: Tom Kralidis |
| 9 | + |
| 10 | +- status: draft |
| 11 | +- modified: 2024-11-19 |
| 12 | + |
| 13 | +## Overview |
| 14 | + |
| 15 | +This RFC describes enhanced limit handling implementation in support of better definition and control on data query limiting. |
| 16 | + |
| 17 | +Currently, pygeoapi defines a `server.limit` configuration directive which corresponds to the `limit` query parameter as part of the OGC API - Features and OGC API - Records `.../items` endpoint. The following scenarios are missing from this setting: |
| 18 | + |
| 19 | +- the ability for the server to provide a default limit when the user does not explicitly specify a limit |
| 20 | +- the ability for the server to provide a maximum limit when the user specifies a limit that is deemed too large by the server to process |
| 21 | +- given this setting is defined at the server level, it may not be suitable for all datasets in a given configuration |
| 22 | +- limits currently only apply to vector data |
| 23 | + |
| 24 | +## Proposed solution |
| 25 | + |
| 26 | +pygeoapi will define a `limits` configuration parameter that will allow a user to define default and maximum limits for multiple data types. This parameter will be defined at the server level (`server.limits`) with the ability to override at resource level (`resources[*].limits`). An example of this setting is shown below: |
| 27 | + |
| 28 | +```yaml |
| 29 | +limits: |
| 30 | + defaultitems: 10 # applies to vector data |
| 31 | + maxitems: 500 # applies to vector data |
| 32 | + maxdistance: [x, y] # applies to all datasets |
| 33 | +``` |
| 34 | +
|
| 35 | +The `limits` setting will be applied as follows: |
| 36 | + |
| 37 | +- pygeoapi administrator is able to use at both the `server` and `resources` levels, with `resources` limits overriding server wide `limits` settings |
| 38 | +- no limit specified by client: use `limits.defaultitems` to set the result set size |
| 39 | +- limit specified by client: calculate the minimum of the query parameter and `limits.maxitems` to set the result set size |
| 40 | +- bbox or spatial dimensions: compare distance of request to maximum definition allowed in `limits.maxdistance` |
| 41 | + |
| 42 | +## Implementation |
| 43 | + |
| 44 | +An `evaluate_limit` function will be added to the `pygeoapi` module for use by `pygeoapi.api` accordingly. |
| 45 | + |
| 46 | +### Backwards Compatibility Issues |
| 47 | + |
| 48 | +The `limits` setting fully replaces `server.limit` and represents a compatibility break. The new functionality will not be backported to other branches. |
| 49 | + |
| 50 | +### Testing |
| 51 | + |
| 52 | +Tests will be added to ensure the expected functionality. |
| 53 | + |
| 54 | +### Documentation |
| 55 | + |
| 56 | +Documentation will be added to the configuration description page. |
| 57 | + |
| 58 | +## Issue and Pull Request tracking |
| 59 | + |
| 60 | +Issue: <https://github.com/geopython/pygeoapi/issues/1856> |
| 61 | + |
| 62 | +Branch: <https://github.com/geopython/pygeoapi/tree/limits> |
| 63 | + |
| 64 | +Pull Request: TBD |
| 65 | + |
| 66 | +## Voting History |
| 67 | + |
| 68 | +TBD |
0 commit comments