Skip to content

Commit

Permalink
Merge branch 'main' of github.com:pblottiere/QSA into pre-commit-mark…
Browse files Browse the repository at this point in the history
…down
  • Loading branch information
JakobMiksch committed Sep 24, 2024
2 parents 8e6c95a + 1386e2a commit b2b208c
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 5 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 : <https://github.com/pblottiere/QSA/pull/68>
- Add basic cache entrypoints : <https://github.com/pblottiere/QSA/pull/74>
- Add data type and band counts metadata for raster layers : <https://github.com/pblottiere/QSA/pull/80>

### Fixed

- Always create parent directory for internal sqlite database : <https://github.com/pblottiere/QSA/pull/73>
- Clear MapProxy legends cache : <https://github.com/pblottiere/QSA/pull/78>

## [1.0.0] - 2024-07-31

### Added
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -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/)

Expand Down
6 changes: 3 additions & 3 deletions docs/src/qsa-api/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
18 changes: 18 additions & 0 deletions docs/src/sandbox/raster/layers.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion qsa-api/qsa_api/mapproxy/mapproxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
7 changes: 7 additions & 0 deletions qsa-api/qsa_api/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit b2b208c

Please sign in to comment.