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
Copy file name to clipboardexpand all lines: docs/source/configuration.rst
+85-48
Original file line number
Diff line number
Diff line change
@@ -49,7 +49,15 @@ For more information related to API design rules (the ``api_rules`` property in
49
49
gzip: false # default server config to gzip/compress responses to requests with gzip in the Accept-Encoding header
50
50
cors: true # boolean on whether server should support CORS
51
51
pretty_print: true # whether JSON responses should be pretty-printed
52
-
limit: 10# server limit on number of items to return
52
+
53
+
limits: # server limits on number of items to return. This property can also be defined at the resource level to override global server settings
54
+
default_items: 50
55
+
max_items: 1000
56
+
max_distance_x: 25
57
+
max_distance_y: 25
58
+
max_distance_units: m
59
+
on_exceed: throttle # throttle or error (default=throttle)
60
+
53
61
admin: false # whether to enable the Admin API
54
62
55
63
# optional configuration to specify a different set of templates for HTML pages. Recommend using absolute paths. Omit this to use the default provided templates
@@ -254,6 +262,41 @@ default.
254
262
.. seealso::
255
263
:ref:`plugins` for more information on plugins
256
264
265
+
Using environment variables
266
+
---------------------------
267
+
268
+
pygeoapi configuration supports using system environment variables, which can be helpful
269
+
for deploying into `12 factor <https://12factor.net/>`_ environments for example.
270
+
271
+
Below is an example of how to integrate system environment variables in pygeoapi.
272
+
273
+
.. code-block:: yaml
274
+
275
+
server:
276
+
bind:
277
+
host: ${MY_HOST}
278
+
port: ${MY_PORT}
279
+
280
+
Multiple environment variables are supported as follows:
281
+
282
+
.. code-block:: yaml
283
+
284
+
data: ${MY_HOST}:${MY_PORT}
285
+
286
+
It is also possible to define a default value for a variable in case it does not exist in
287
+
the environment using a syntax like: ``value: ${ENV_VAR:-the default}``
288
+
289
+
.. code-block:: yaml
290
+
291
+
server:
292
+
bind:
293
+
host: ${MY_HOST:-localhost}
294
+
port: ${MY_PORT:-5000}
295
+
metadata:
296
+
identification:
297
+
title:
298
+
en: This is pygeoapi host ${MY_HOST} and port ${MY_PORT:-5000}, nice to meet you!
299
+
257
300
Adding links to collections
258
301
---------------------------
259
302
@@ -389,53 +432,6 @@ If omitted, no header will be added. Common names for this header are ``API-Vers
389
432
Note that pygeoapi already adds a ``X-Powered-By`` header by default that includes the software version number.
390
433
391
434
392
-
Validating the configuration
393
-
----------------------------
394
-
395
-
To ensure your configuration is valid, pygeoapi provides a validation
pygeoapi configuration supports using system environment variables, which can be helpful
407
-
for deploying into `12 factor <https://12factor.net/>`_ environments for example.
408
-
409
-
Below is an example of how to integrate system environment variables in pygeoapi.
410
-
411
-
.. code-block:: yaml
412
-
413
-
server:
414
-
bind:
415
-
host: ${MY_HOST}
416
-
port: ${MY_PORT}
417
-
418
-
Multiple environment variables are supported as follows:
419
-
420
-
.. code-block:: yaml
421
-
422
-
data: ${MY_HOST}:${MY_PORT}
423
-
424
-
It is also possible to define a default value for a variable in case it does not exist in
425
-
the environment using a syntax like: ``value: ${ENV_VAR:-the default}``
426
-
427
-
.. code-block:: yaml
428
-
429
-
server:
430
-
bind:
431
-
host: ${MY_HOST:-localhost}
432
-
port: ${MY_PORT:-5000}
433
-
metadata:
434
-
identification:
435
-
title:
436
-
en: This is pygeoapi host ${MY_HOST} and port ${MY_PORT:-5000}, nice to meet you!
437
-
438
-
439
435
Hierarchical collections
440
436
------------------------
441
437
@@ -507,6 +503,36 @@ Examples:
507
503
curl https://example.org/collections/lakes/items # only the name attribute is returned in properties
508
504
curl https://example.org/collections/lakes/items/{item_id} # only the name attribute is returned in properties
509
505
506
+
Limiting data responses
507
+
-----------------------
508
+
509
+
pygeoapi defines a ``limits`` configuration parameter that will allow a user to define default and maximum limits for multiple data types. This parameter is 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:
510
+
511
+
.. code-block:: yaml
512
+
513
+
limits:
514
+
default_items: 10# applies to vector data
515
+
max_items: 500# applies to vector data
516
+
max_distance_x: 123# applies to all datasets
517
+
max_distance_y: 456# applies to all datasets
518
+
max_distance_units: m # as per UCUM https://ucum.org/ucum#section-Tables-of-Terminal-Symbols
519
+
on_exceed: error # one of error, throttle
520
+
521
+
The ``limits`` setting is applied as follows:
522
+
523
+
- can be defined at both the server and resources levels, with resource limits overriding server wide limits settings
524
+
- ``on_exceed`` can be set to ``error`` or ``throttle`` (default). If a client specified limit exceeds those set by the server:
525
+
- when set to ``error``, an exception is returned
526
+
- when set to ``throttle`` the maximum data allowed by the collection/server/provider is returned
527
+
528
+
Vector data (features, records)
529
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
530
+
- when a limit not specified by the client, ``limits.default_items`` can be used to set the result set size
531
+
- when a limit is specified by the client, the minimum of the ``limit`` parameter and ``limits.max_items`` is calculated to set the result set size
532
+
533
+
Raster data (coverages, environmental data retrieval)
- when a bbox or spatial subset is specified by the client, ``limits.max_distance_x``, ``limits.max_distance_y`` and ``limits.max_distance_units`` are used to determine whether a request has asked for more data than the collection is configured to provide and respond accordingly (via ``on_exceed``)
510
536
511
537
Linked Data
512
538
-----------
@@ -638,6 +664,17 @@ deployment flexibility, the path can be specified with string interpolation of e
638
664
The template ``tests/data/base.jsonld`` renders the unmodified JSON-LD. For more information on the capacities
639
665
of Jinja2 templates, see :ref:`html-templating`.
640
666
667
+
Validating the configuration
668
+
----------------------------
669
+
670
+
To ensure your configuration is valid, pygeoapi provides a validation
Copy file name to clipboardexpand all lines: docs/source/cql.rst
+29-23
Original file line number
Diff line number
Diff line change
@@ -3,15 +3,18 @@
3
3
CQL support
4
4
===========
5
5
6
+
OGC Common Query Language (`CQL2`_) is a generic language designed to provide enhanced query and subset/filtering to (primarily) feature and record data.
7
+
6
8
Providers
7
9
---------
8
10
9
-
As of now the available providers supported for CQL filtering are limited to :ref:`Elasticsearch <Elasticsearch>` and :ref:`PostgreSQL <PostgreSQL>`.
10
-
11
+
CQL2 support is implemented in various pygeoapi feature and record providers. See the :ref:`feature <ogcapi-features>` and :ref:`metadata <ogcapi-records>` provider sections
12
+
for current provider support.
13
+
11
14
Limitations
12
15
-----------
13
16
14
-
Support of CQL is limited to `Simple CQL filter <https://portal.ogc.org/files/96288#cql-core>`_ and thus it allows to query with the
17
+
Support of CQL is limited to `Basic CQL2 <https://docs.ogc.org/is/21-065r2/21-065r2.html#cql2-core>`_ and thus it allows to query with the
15
18
following predicates:
16
19
17
20
* comparison predicates
@@ -21,20 +24,20 @@ following predicates:
21
24
Formats
22
25
-------
23
26
24
-
At the moment Elasticsearch supports only the CQL dialect with the JSON encoding `CQL-JSON <https://portal.ogc.org/files/96288#simple-cql-JSON>`_.
27
+
Supported providers leverage the CQL2 dialect with the JSON encoding `CQL-JSON <https://docs.ogc.org/is/21-065r2/21-065r2.html#cql2-json>`_.
25
28
26
-
PostgreSQL supports both CQL-JSON and CQL-text dialects, `CQL-JSON <https://portal.ogc.org/files/96288#simple-cql-JSON>`_ and `CQL-TEXT <https://portal.ogc.org/files/96288#simple-cql-text>`_
29
+
PostgreSQL supports both `CQL2 JSON <https://docs.ogc.org/is/21-065r2/21-065r2.html#cql2-json>`_ and `CQL text <https://docs.ogc.org/is/21-065r2/21-065r2.html#cql2-text>`_ dialects.
27
30
28
31
Queries
29
32
^^^^^^^
30
33
31
34
The PostgreSQL provider uses `pygeofilter <https://github.com/geopython/pygeofilter>`_ allowing a range of filter expressions, see examples for:
Note that the CQL text has been URL encoded. This is required in curl commands but when entering in a browser, plain text can be used e.g. ``CROSSES(foo_geom, LINESTRING(28 -2, 30 -4))``.
0 commit comments