Skip to content

Commit

Permalink
Fix CI
Browse files Browse the repository at this point in the history
  • Loading branch information
llienher committed Nov 14, 2024
1 parent d683ee6 commit 870a81d
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 35 deletions.
2 changes: 1 addition & 1 deletion admin/c2cgeoportal_admin/schemas/dimensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

def dimensions_schema_node(
prop: InstrumentedAttribute[Any],
) -> colander.SequenceSchema: # pylint: disable=unsubscriptable-object`
) -> colander.SequenceSchema: # pylint: disable=unsubscriptable-object` # pylint: disable=unsubscriptable-object`
"""Get the scheme of the dimensions."""
return colander.SequenceSchema(
GeoFormSchemaNode(Dimension, name="dimension", widget=MappingWidget(template="dimension")),
Expand Down
2 changes: 1 addition & 1 deletion admin/c2cgeoportal_admin/schemas/restriction_areas.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

def restrictionareas_schema_node(
prop: InstrumentedAttribute[Any],
) -> colander.SequenceSchema: # pylint: disable=unsubscriptable-object`
) -> colander.SequenceSchema: # pylint: disable=unsubscriptable-object` # pylint: disable=unsubscriptable-object`
"""Get the schema of a restriction area."""
return colander.SequenceSchema(
GeoFormManyToManySchemaNode(RestrictionArea, None),
Expand Down
36 changes: 18 additions & 18 deletions doc/integrator/ogc_api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,49 +4,49 @@ OGC API Features
----------------

The OGC API is a new standard that defines modular API following REST standard to access spatial data.
The current implementation is only on the server side and is based on the OGC API - Features standard and only works with the GetFeature request using a bbox filter.
The current implementation is only on the server side and is based on the OGC API - Features standard and only works with the `items` request using a bbox filter.

It is currently supported by both MapServer and QGISserver.

The following variables should be added to the docker-compose-lib.yaml file for the 'MapServer' service:
The following new environment variables should be added to the docker-compose-lib.yaml file for the 'MapServer' service:

.. prompt:: bash::

environment:
...
- MAPSERVER_BASE_PATH=/mapserv_proxy/mapserver
- MAPSERVER_BASE_PATH=/mapserv_proxy
- OGCAPI_HTML_TEMPLATE_DIRECTORY=/usr/local/share/mapserver/ogcapi/templates/html-bootstrap4/
...


The following changes has to be done to the Mapfiles to support the OGC API:

In the MapServer configuration file, the following changes could be added to set an alias to a the MAPS block:
.. prompt:: bash::

MAP
...
WEB
...
TEMPLATE "dummy""
...
END
...
#
# Map aliases
#
MAPS
ExampleOGCserver "/etc/mapserver/mapserver.map"
END

QGISserver is already configured to support the OGC API and detect automatically if wfs3 path is used.
Then used this alias as the ogc-server value in the URL for MapServer.

It is also recommanded for any server type, to remove all special characters in the OGC Server names because they appear in the path of the URL.

QGIS Server and MapServer are already configured to support the OGC API and detect automatically if the compatible path is requested.

Landing pages for both MapServer and QGISserver are not supported yet.

OGC API features are accessible through mapserv_proxy, with the following URLs:
* ``/mapserv_proxy/<ogc-server>/ogcapi/*``: The Mapserver path.
* ``/mapserv_proxy/<ogc-server>/wfs3/*``: The QGISserver path.
* ``/mapserv_proxy/<ogc-server>/ogcapi/*``: The MapServer path.
* ``/mapserv_proxy/<ogc-server>/wfs3/*``: The QGIS Server path.


OGC API Documentation
---------------------

Mapserver documentation:
MapServer documentation:
https://mapserver.org/ogc/ogc_api.html

QGISserver documentation:
QGIS Server documentation:
https://docs.qgis.org/3.34/en/docs/server_manual/services/ogcapif.html
15 changes: 0 additions & 15 deletions geoportal/c2cgeoportal_geoportal/views/mapserverproxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,19 +174,6 @@ def proxy_ogcapi_qgisserver(self) -> Response:
return self.proxy_ogcapi("wfs3")

def proxy_ogcapi(self, subpath: str) -> Response:
if self.user is None and "authentication_required" in self.request.params:
_LOG.debug("proxy() detected authentication_required")
if self.request.registry.settings.get("basicauth", "False").lower() == "true":
raise HTTPUnauthorized(
headers={"WWW-Authenticate": 'Basic realm="Access to restricted layers"'}
)
raise HTTPForbidden("Basic auth is not enabled")

# We have a user logged in. We need to set group_id and possible layer_name in the params. We set
# layer_name when either QUERY_PARAMS or LAYERS is set in the WMS params, i.e. for GetMap and
# GetFeatureInfo requests. For GetLegendGraphic requests we do not send layer_name, but MapServer
# should not use the DATA string for GetLegendGraphic.

if self.ogc_server.auth == main.OGCSERVER_AUTH_STANDARD:
self.params["role_ids"] = ",".join([str(e) for e in get_roles_id(self.request)])

Expand All @@ -206,8 +193,6 @@ def proxy_ogcapi(self, subpath: str) -> Response:
# Add functionalities params
self.params.update(get_mapserver_substitution_params(self.request))

# we want the browser to cache GetLegendGraphic and
# DescribeFeatureType requests
use_cache = False

errors: set[str] = set()
Expand Down

0 comments on commit 870a81d

Please sign in to comment.