diff --git a/CHANGELOG.md b/CHANGELOG.md index 485859a..c358bb5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,19 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## [1.1.0] - 2024-09-24 + +### Added + +- Add Python files after installation of dependencies in Dockerfile : +- Add basic cache entrypoints : +- Add data type and band counts metadata for raster layers : + +### Fixed + +- Always create parent directory for internal sqlite database : +- Clear MapProxy legends cache : + ## [1.0.0] - 2024-07-31 ### Added diff --git a/README.md b/README.md index 1307896..5297c21 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # QGIS Server Administration -[![Release](https://img.shields.io/badge/release-1.0.0-green.svg)](https://github.com/pblottiere/QSA/releases) +[![Release](https://img.shields.io/badge/release-1.1.0-green.svg)](https://github.com/pblottiere/QSA/releases) [![CI](https://img.shields.io/github/actions/workflow/status/pblottiere/QSA/tests.yml)](https://github.com/pblottiere/QSA/actions) [![Documentation](https://img.shields.io/badge/docs-Book-informational)](https://pblottiere.github.io/QSA/) diff --git a/docs/src/qsa-api/installation.md b/docs/src/qsa-api/installation.md index 36c8e8f..961ebe1 100644 --- a/docs/src/qsa-api/installation.md +++ b/docs/src/qsa-api/installation.md @@ -15,9 +15,9 @@ $ . venv/bin/activate A prebuilt image can be found on `ghcr.io/pblottiere/qsa`: ```` shell -docker pull ghcr.io/pblottiere/qsa:1.0.0 +docker pull ghcr.io/pblottiere/qsa:1.1.0 ```` Otherwise the image can manually be built using: -`docker build -t my-custom-qsa-image .`. See [Sandbox](sandbox/) for details -how to use it. +`docker build -t my-custom-qsa-image .`. See [Sandbox](../sandbox/index.html) +for details how to use it. diff --git a/docs/src/sandbox/raster/layers.md b/docs/src/sandbox/raster/layers.md index df3c2f4..8313e97 100644 --- a/docs/src/sandbox/raster/layers.md +++ b/docs/src/sandbox/raster/layers.md @@ -21,8 +21,26 @@ true ## List layers and get metadata ```` shell +# list layers $ curl "http://localhost:5000/api/projects/my_project/layers?schema=my_schema" ["polygons","dem"] + +# get metadata +$ curl "http://localhost:5000/api/projects/my_project/layers/dem?schema=my_schema" +{ + "bands": 1, + "bbox": "18.6662979442000001 45.77670143760000343, 18.70359794419999844 45.81170143760000002", + "crs": "EPSG:4326", + "current_style": "default", + "data_type": "float32", + "name": "dem", + "source": "/dem.tif", + "styles": [ + "default" + ], + "type": "raster", + "valid": true +} ```` ## Map sample diff --git a/qsa-api/qsa_api/mapproxy/mapproxy.py b/qsa-api/qsa_api/mapproxy/mapproxy.py index 72e7533..9535145 100644 --- a/qsa-api/qsa_api/mapproxy/mapproxy.py +++ b/qsa-api/qsa_api/mapproxy/mapproxy.py @@ -84,10 +84,14 @@ def clear_cache(self, layer_name: str) -> None: bucket.objects.filter(Prefix=cache_dir).delete() else: cache_dir = self._mapproxy_project.parent / "cache_data" - self.debug(f"Clear cache '{cache_dir}'") + self.debug(f"Clear tiles cache '{cache_dir}'") for d in cache_dir.glob(f"{layer_name}_cache_*"): shutil.rmtree(d) + cache_dir = self._mapproxy_project.parent / "cache_data" / "legends" + self.debug(f"Clear legends cache '{cache_dir}'") + shutil.rmtree(cache_dir, ignore_errors=True) + def add_layer( self, name: str, diff --git a/qsa-api/qsa_api/project.py b/qsa-api/qsa_api/project.py index 9179b85..6e36c30 100644 --- a/qsa-api/qsa_api/project.py +++ b/qsa-api/qsa_api/project.py @@ -218,6 +218,9 @@ def layer(self, name: str) -> dict: if layer.type() == Qgis.LayerType.Vector: infos["geometry"] = QgsWkbTypes.displayString(layer.wkbType()) + elif layer.type() == Qgis.LayerType.Raster: + infos["bands"] = layer.bandCount() + infos["data_type"] = layer.dataProvider().dataType(1).name.lower() infos["source"] = layer.source() infos["crs"] = layer.crs().authid() @@ -320,6 +323,10 @@ def exists(self) -> bool: ) projects = storage.listProjects(uri) + # necessary step if the project has been created without QSA + if self.name in projects: + self._qgis_projects_dir().mkdir(parents=True, exist_ok=True) + return self.name in projects and self._qgis_projects_dir().exists() def create(self, author: str) -> (bool, str):