Skip to content

Commit 63fef5e

Browse files
authored
Document oga_fallback_to_map_extent and oga_use_default_extent_for_getfeature (#1067)
1 parent 95b2e8b commit 63fef5e

2 files changed

Lines changed: 129 additions & 45 deletions

File tree

en/ogc/ogc_api.txt

Lines changed: 87 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99

1010
:Author: Jeff McKenna
1111
:Contact: jmckenna at gatewaygeomatics.com
12-
:Last Updated: 2025-12-12
12+
:Author: Seth Girvin
13+
:Contact: sethg at geographika.co.uk
14+
:Last Updated: 2026-03-26
1315

1416
.. contents:: Table of Contents
1517
:depth: 3
@@ -274,6 +276,8 @@ Example OGC API Server Mapfile
274276
"ows_getfeatureinfo_formatlist" "text/plain,text/html,application/json,application/vnd.ogc.gml,gml"
275277
"ows_enable_request" "*" #REQUIRED
276278
"oga_html_template_directory" "share/ogcapi/templates/html-bootstrap/" #REQUIRED
279+
"oga_fallback_to_map_extent" "true" # Optional. Can improve performance.
280+
"oga_use_default_extent_for_getfeature" "false" # Optional. Can improve performance.
277281
END
278282
END
279283

@@ -302,7 +306,8 @@ Example OGC API Server Mapfile
302306
"ows_abstract" "Oceans, NaturalEarth dataset, 2020"
303307
"gml_include_items" "all" #REQUIRED
304308
"gml_featureid" "ne_id" #REQUIRED
305-
"oga_use_default_extent_for_getfeature" # Optional. Can improve performance.
309+
"oga_fallback_to_map_extent" "false" # Optional. Override WEB setting
310+
"oga_use_default_extent_for_getfeature" "true" # Optional. Override WEB setting
306311
"oga_queryable_items" "all" # required to allow filtering
307312
"oga_geometry_format" "geometry-polygn"
308313
"oga_sortable_items" "area"
@@ -462,13 +467,13 @@ Web Object Metadata
462467
-------------------
463468

464469
.. index::
465-
triple: OGCAPI; METADATA; ows_extra_params
470+
triple: OGCAPI; METADATA; oga_extra_params
466471

467-
**ows_extra_params**
472+
**oga_extra_params**
468473

469474
.. versionadded:: 8.6.0
470475

471-
- *Description:* (Optional) The ``ows_extra_params`` (or ``oga_extra_params``) metadata entry allows you to append
476+
- *Description:* (Optional) The ``oga_extra_params`` (or ``ows_extra_params``) metadata entry allows you to append
472477
additional query parameters to all URLs generated by MapServer. This can be used, for example,
473478
to include authentication tokens such as JSON Web Tokens (JWT) in your API requests.
474479

@@ -522,6 +527,34 @@ Web Object Metadata
522527
The extra parameters are available in HTML templates for the OGC Features API as ``{{ template.extra_params }}``.
523528
The templates supplied in the MapServer repository append this value to all URLs by default.
524529

530+
.. _oga_fallback_to_map_extent:
531+
532+
.. index::
533+
triple: OGCAPI; METADATA; oga_fallback_to_map_extent
534+
535+
**oga_fallback_to_map_extent**
536+
537+
.. versionadded:: 8.8.0
538+
539+
- *Description:* (Optional) (or ``ows_fallback_to_map_extent``)
540+
When set to ``true``, if a ``LAYER`` has no explicit
541+
:ref:`EXTENT <mapfile-layer-extent>` and no ``ows_extent`` metadata item,
542+
MapServer will use the :ref:`MAP EXTENT <mapfile-map-extent>` as a fallback
543+
rather than querying the datasource to calculate the layer extent.
544+
The full priority order for extent resolution is:
545+
546+
1. Layer ``ows_extent`` (or namespace-specific ``oga_extent``) metadata
547+
2. Layer ``EXTENT``
548+
3. Map ``EXTENT``, if this metadata item is set to ``true`` *(this option)*
549+
4. Extent calculated from the datasource
550+
551+
Datasource extent calculation can be very slow for database
552+
layers. For some layer types (e.g. raster), it may be near-instant.
553+
554+
This item can be set in ``MAP WEB METADATA`` to apply to all layers, and
555+
can be overridden per-layer in ``LAYER METADATA`` to enable or disable the
556+
fallback for specific layers.
557+
525558
.. index::
526559
triple: OGCAPI; METADATA; oga_features_cache_count
527560

@@ -543,20 +576,27 @@ Web Object Metadata
543576
Size of cache in bytes. See :ref:`wfs_features_cache_size` for details.
544577

545578
.. index::
546-
triple: OGCAPI; METADATA; ows_schemas_location
579+
triple: OGCAPI; METADATA; oga_geometry_format
547580

548-
**ows_schemas_location**
581+
**oga_geometry_format**
549582

550-
.. versionadded:: 8.2.0
583+
.. versionadded:: 8.8.0
551584

552-
- *Description:* (Optional) (Note the name *ows_schemas_location* because all
553-
OGC Web Services (OWS) use the same metadata) Root of the web tree where
554-
the family of OGC API JSON Schema files are located. This must be a valid URL
555-
where the actual .yaml files are located if you want your OpenAPI description
556-
to be valid. Default is *http://schemas.opengis.net*
585+
- *Description:* (Optional) Value among "geometry-point", "geometry-multipoint",
586+
"geometry-linestring", "geometry-multilinestring", "geometry-polygon",
587+
"geometry-multipolygon", "geometry-geometrycollection", "geometry-any" (default value),
588+
"geometry-point-or-multipoint", "geometry-linestring-or-multilinestring"
589+
and "geometry-polygon-or-multipolygon"
557590

558-
.. index::
559-
triple: OGCAPI; METADATA; oga_queryable_items
591+
- Example Mapfile:
592+
593+
.. code-block:: mapfile
594+
595+
LAYER
596+
METADATA
597+
"oga_geometry_format" "geometry-polygon-or-multipolygon"
598+
END
599+
END
560600

561601
**oga_queryable_items**
562602

@@ -604,41 +644,52 @@ Web Object Metadata
604644
END
605645
END
606646

647+
.. _oga_use_default_extent_for_getfeature:
648+
607649
.. index::
608-
triple: OGCAPI; METADATA; oga_geometry_format
650+
triple: OGCAPI; METADATA; ows_schemas_location
609651

610-
**oga_geometry_format**
652+
**oga_use_default_extent_for_getfeature**
611653

612-
.. versionadded:: 8.8.0
654+
.. versionadded:: 8.4.0
613655

614-
- *Description:* (Optional) Value among "geometry-point", "geometry-multipoint",
615-
"geometry-linestring", "geometry-multilinestring", "geometry-polygon",
616-
"geometry-multipolygon", "geometry-geometrycollection", "geometry-any" (default value),
617-
"geometry-point-or-multipoint", "geometry-linestring-or-multilinestring"
618-
and "geometry-polygon-or-multipolygon"
656+
- *Description:* (Optional) (or ``ows_use_default_extent_for_getfeature``)
657+
Use ``MAP`` ``EXTENT`` as a spatial filter if no bbox is in the request.
658+
Setting to ``"false"`` can improve performance. See WFS equivalent
659+
at :ref:`wfs_use_default_extent_for_getfeature`.
619660

620-
- Example Mapfile:
661+
**ows_schemas_location**
621662

622-
.. code-block:: mapfile
663+
.. versionadded:: 8.2.0
623664

624-
LAYER
625-
METADATA
626-
"oga_geometry_format" "geometry-polygon-or-multipolygon"
627-
END
628-
END
665+
- *Description:* (Optional) (Note the name *ows_schemas_location* because all
666+
OGC Web Services (OWS) use the same metadata) Root of the web tree where
667+
the family of OGC API JSON Schema files are located. This must be a valid URL
668+
where the actual .yaml files are located if you want your OpenAPI description
669+
to be valid. Default is *http://schemas.opengis.net*
629670

630671
.. index::
631-
triple: OGCAPI; METADATA; oga_use_default_extent_for_getfeature
672+
triple: OGCAPI; METADATA; oga_queryable_items
632673

633674
Layer Object Metadata
634675
---------------------
635676

677+
.. index::
678+
triple: OGCAPI; METADATA; oga_fallback_to_map_extent
679+
680+
**oga_fallback_to_map_extent**
681+
682+
.. versionadded:: 8.8.0
683+
684+
Same as :ref:`oga_fallback_to_map_extent <oga_fallback_to_map_extent>` in ``MAP WEB METADATA``, and can be
685+
set here to override the behaviour for individual layers.
686+
687+
.. index::
688+
triple: OGCAPI; METADATA; oga_use_default_extent_for_getfeature
689+
636690
**oga_use_default_extent_for_getfeature**
637691

638692
.. versionadded:: 8.4.0
639693

640-
- *Description:* (Optional) (or ``ows_use_default_extent_for_getfeature``)
641-
Use ``MAP`` ``EXTENT`` as a spatial filter if no bbox is in the request.
642-
Setting to ``"false"`` can improve performance. See WFS equivalent
643-
at :ref:`wfs_use_default_extent_for_getfeature`.
644-
694+
Same as :ref:`oga_use_default_extent_for_getfeature <oga_use_default_extent_for_getfeature>` in ``MAP WEB METADATA``, and can be
695+
set here to override the behaviour for individual layers.

en/ogc/wfs_server.txt

Lines changed: 42 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -801,6 +801,22 @@ Web Object Metadata
801801

802802
"wfs_enable_request" "* !GetCapabilities"
803803

804+
.. _wfs_fallback_to_map_extent:
805+
806+
.. index::
807+
triple: WFS; METADATA; wfs_fallback_to_map_extent
808+
809+
**wfs_fallback_to_map_extent**
810+
811+
.. versionadded:: 8.8.0
812+
813+
- *Description:* (Optional) (or ``ows_fallback_to_map_extent``)
814+
When set to ``true``, if a ``LAYER`` has no explicit
815+
:ref:`EXTENT <mapfile-layer-extent>` and no ``ows_extent`` metadata item,
816+
MapServer will use the :ref:`MAP EXTENT <mapfile-map-extent>` as a fallback
817+
rather than querying the datasource to calculate the layer extent.
818+
See :ref:`oga_fallback_to_map_extent <oga_fallback_to_map_extent>` for details
819+
804820
.. index::
805821
triple: WFS; METADATA; wfs_feature_collection
806822

@@ -1024,6 +1040,20 @@ Web Object Metadata
10241040
(Required) Human readable title to identify server.
10251041
WFS TAG Name: Title (WFS 1.0.0, sect. 12.3.3)
10261042

1043+
.. _wfs_use_default_extent_for_getfeature:
1044+
1045+
.. index::
1046+
triple: WFS; METADATA; wfs_use_default_extent_for_getfeature
1047+
1048+
**wfs_use_default_extent_for_getfeature**
1049+
(Optional, since MapServer 7.0.4) Whether the MAP.EXTENT should be used in
1050+
request to datasources in the absence of other spatial filter. This is the
1051+
default behaviour, but this might affect performance in some use cases. In
1052+
those cases, setting this item to "false" will avoid the default spatial filter to
1053+
be appended to the request. This is only implemented for OGR datasources (since 7.0.4),
1054+
MSSQL2008 (since 7.6), and PostGIS connections (since 8.4).
1055+
Use **ows_use_default_extent_for_getfeature** to set for both WFS and :ref:`ogcapi`.
1056+
10271057
.. index::
10281058
triple: WFS; LAYER; METADATA
10291059

@@ -1335,6 +1365,16 @@ Layer Object
13351365
projection units. If wfs_extent is provided then it has priority and
13361366
MapServer will NOT try to read the source file's extents.
13371367

1368+
.. index::
1369+
triple: WFS; METADATA; wfs_fallback_to_map_extent
1370+
1371+
**wfs_fallback_to_map_extent**
1372+
1373+
.. versionadded:: 8.8.0
1374+
1375+
Same as :ref:`wfs_fallback_to_map_extent <wfs_fallback_to_map_extent>` in ``MAP WEB METADATA``, and can be
1376+
set here to override the behaviour for individual layers.
1377+
13381378
.. index::
13391379
triple: WFS; METADATA; wfs_featureid
13401380

@@ -1467,16 +1507,9 @@ Layer Object
14671507
.. index::
14681508
triple: WFS; METADATA; wfs_use_default_extent_for_getfeature
14691509

1470-
.. _wfs_use_default_extent_for_getfeature:
1471-
14721510
**wfs_use_default_extent_for_getfeature**
1473-
(Optional, since MapServer 7.0.4) Whether the MAP.EXTENT should be used in
1474-
request to datasources in the absence of other spatial filter. This is the
1475-
default behaviour, but this might affect performance in some use cases. In
1476-
those cases, setting this item to "false" will avoid the default spatial filter to
1477-
be appended to the request. This is only implemented for OGR datasources (since 7.0.4),
1478-
MSSQL2008 (since 7.6), and PostGIS connections (since 8.4).
1479-
Use **ows_use_default_extent_for_getfeature** to set for both WFS and :ref:`ogcapi`.
1511+
Same as :ref:`wfs_use_default_extent_for_getfeature <wfs_use_default_extent_for_getfeature>` in ``MAP WEB METADATA``, and can be
1512+
set here to override the behaviour for individual layers.
14801513

14811514
Layer Metadata API
14821515
----------------------

0 commit comments

Comments
 (0)