diff --git a/Dockerfile b/Dockerfile index 1ce3aa1..20d3775 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 \ @@ -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"] diff --git a/qsa-api/qsa_api/project.py b/qsa-api/qsa_api/project.py index c397226..d9ba9b2 100644 --- a/qsa-api/qsa_api/project.py +++ b/qsa-api/qsa_api/project.py @@ -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) @@ -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()