Skip to content

Commit

Permalink
Publish WFS by default
Browse files Browse the repository at this point in the history
  • Loading branch information
JakobMiksch authored Aug 6, 2024
1 parent 8dc4895 commit fa47909
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ RUN apt-get update \
&& rm -rf /var/lib/apt/lists/*

WORKDIR /qsa
ADD qsa-api/qsa_api /qsa/qsa_api
ADD qsa-api/pyproject.toml .

RUN rm -rf venv \
Expand All @@ -16,6 +15,7 @@ RUN rm -rf venv \
&& pip install gunicorn \
&& poetry install

ADD qsa-api/qsa_api /qsa/qsa_api
ENV PATH=/qsa/venv/bin:$PATH
EXPOSE 5000
CMD ["gunicorn" , "-b", "0.0.0.0:5000", "--workers", "1", "--threads", "1", "qsa_api.app:app"]
13 changes: 13 additions & 0 deletions qsa-api/qsa_api/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,7 @@ def add_layer(
if t == Qgis.LayerType.Vector:
self.debug("Init vector layer")
lyr = QgsVectorLayer(datasource, name, provider)
self.debug(lyr)
elif t == Qgis.LayerType.Raster:
self.debug("Init raster layer")
lyr = QgsRasterLayer(datasource, name, provider)
Expand Down Expand Up @@ -396,6 +397,18 @@ def add_layer(
project.read(self._qgis_project_uri, Qgis.ProjectReadFlag.DontResolveLayers)
project.addMapLayer(lyr)

def set_published_wfs_layers(qgis_project_instance, layer_ids):
qgis_project_instance.writeEntry( "WFSLayers" , "/", layer_ids)
geometry_precision = 8
for layer_id in layer_ids:
qgis_project_instance.writeEntry( "WFSLayersPrecision", "/" + layer_id, geometry_precision)
qgis_project_instance.write()

# ensure all vector layers are published by default
if t == Qgis.LayerType.Vector:
vector_layer_ids = [layer.id() for layer in project.mapLayers().values() if isinstance(layer, QgsVectorLayer)]
set_published_wfs_layers(project, vector_layer_ids)

self.debug("Write QGIS project")
project.write()

Expand Down

0 comments on commit fa47909

Please sign in to comment.