diff --git a/README.md b/README.md index 8dac7fd..85b6c2e 100644 --- a/README.md +++ b/README.md @@ -10,8 +10,8 @@ Components: * `qsa-cli`: Command line tool Main features: -* Create and manage QGIS projects stored on filesystem -* Create and update layers: symbology, theme, ... +* Create and manage QGIS projects stored on filesystem or in PostgreSQL +* Create and update vector and raster layers: symbology, theme, ... * Inspect online QGIS Server instances * Cache management with MapProxy diff --git a/docs/src/SUMMARY.md b/docs/src/SUMMARY.md index ba8d9ec..2b02f0b 100644 --- a/docs/src/SUMMARY.md +++ b/docs/src/SUMMARY.md @@ -12,9 +12,10 @@ - [Configuration](qsa-cli/configuration.md) - [Commands](qsa-cli/commands.md) - [Sandbox](sandbox/README.md) - - [Inspect QGIS Server instances](sandbox/inspect.md) - - [Manage projects](sandbox/projects.md) - - [Manage layers](sandbox/layers.md) - - [Manage styles](sandbox/styles.md) + - [Introspection](sandbox/inspect.md) + - [Projects](sandbox/projects.md) + - [Vector layers](sandbox/vector/layers.md) + - [Vector styles](sandbox/vector/styles.md) + - [Raster layers](sandbox/raster/layers.md) - [Developers](DEVELOPERS.md) - [Funders](FUNDERS.md) diff --git a/docs/src/images/raster_dem_map.png b/docs/src/images/raster_dem_map.png new file mode 100644 index 0000000..a0a866d Binary files /dev/null and b/docs/src/images/raster_dem_map.png differ diff --git a/docs/src/qsa-api/configuration.md b/docs/src/qsa-api/configuration.md index 0d741fa..a31146b 100644 --- a/docs/src/qsa-api/configuration.md +++ b/docs/src/qsa-api/configuration.md @@ -11,10 +11,10 @@ QSA web server can be configured thanks to the next environment variables: | No | `QSA_MAPPROXY_PROJECTS_DIR` | Storage location on the filesystem for MapProxy configuration files | -## PostgreSQL support +## PostgreSQL support {#postgresql-support} -When PostgreSQL support is enabled to store QGIS projects thanks to -`QSA_QGISSERVER_PROJECTS_PSQL_SERVICE`, the directory +When PostgreSQL support is enabled to store QGIS projects thanks to the +`QSA_QGISSERVER_PROJECTS_PSQL_SERVICE` environment variable, the directory `QSA_QGISSERVER_PROJECTS_DIR` is only used to store the QSA SQLite database as well as QGIS QML styles. In the future, the QSA database and QGIS styles will also be stored in PostgreSQL when enabled. diff --git a/docs/src/qsa-api/endpoints.md b/docs/src/qsa-api/endpoints.md index 663ce2c..6bf46a1 100644 --- a/docs/src/qsa-api/endpoints.md +++ b/docs/src/qsa-api/endpoints.md @@ -1,10 +1,13 @@ # QSA REST API : endpoints -**Note** : when PostgreSQL support is enabled, a query string parameter `schema` may be -used to specify the schema in which the QGIS projects is stored in the -database (`public` is used by default). For example: +## PostgreSQL schema + +When PostgreSQL support is enabled, a query string parameter `schema` may be +used to specify the schema in which the QGIS project is stored in the database +(`public` is used by default). ```` shell +# call a specific endpoint using projects stored in PostgreSQL schema named `myschema` $ curl "http://localhost/api/xxx/yyy?schema=myschema" ```` @@ -14,6 +17,7 @@ A QSA project is defined by: * a QGIS project * a list of themes +* an internal SQLite database * a MapProxy configuration file (if enabled) | Method | URL | Description | @@ -61,9 +65,10 @@ empty. | POST | `/api/projects/{project}/layers/{layer}/style` | Add/Update layer's style with `name` (style name) and `current` (`true` or `false`) | | DELETE | `/api/projects/{project}/layers/{layer}` | Remove layer from project | -Examples: +Example: ```` shell +# Add a FlatGeobuf vector layer in project `my_project` $ curl "http://localhost/api/projects/my_project/layers" \ -X POST \ -H 'Content-Type: application/json' \ @@ -89,9 +94,10 @@ corresponding parameters depending on QGIS Server version. | GET | `/api/symbology/vector/line/single_symbol/line/properties` | Line simple symbol properties | | GET | `/api/symbology/vector/polygon/single_symbol/fill/properties` | Polygon simple symbol properties | -Examples: +Example: ```` shell +# Return single symbol properties for polygon layers $ curl "http://localhost:5000/api/symbology/vector/polygon/single_symbol/fill/properties" | jq { "border_width_map_unit_scale": "3x:0,0,0,0,0,0", @@ -113,7 +119,7 @@ $ curl "http://localhost:5000/api/symbology/vector/polygon/single_symbol/fill/pr A QSA style may be used through the `STYLE` OGC web services parameter to specify the rendering for a specific layer. Default styles may be defined and -used when a layer is added to a project. +automatically used when a layer is added to a QSA project. | Method | URL | Description | |---------|-----------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------| @@ -124,9 +130,10 @@ used when a layer is added to a project. | POST | `/api/projects/{project}/styles/default` | Set default style for a specific geometry with `geometry` and `name` | | DELETE | `/api/projects/{project}/styles/{style}` | Remove style from project | -Examples: +Example: ```` shell +# Add a style for point geometry vector layers $ curl "http://localhost:5000/api/projects/my_project/styles" \ -X POST \ -H 'Content-Type: application/json' \ diff --git a/docs/src/sandbox/README.md b/docs/src/sandbox/README.md index e3afb64..0c52811 100644 --- a/docs/src/sandbox/README.md +++ b/docs/src/sandbox/README.md @@ -12,6 +12,7 @@ $ docker-compose up --scale qgisserver=4 -d $ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES d2eaf6bdfae4 pblottiere/qsa "qsa" 2 hours ago Up 9 seconds 0.0.0.0:5000->5000/tcp, :::5000->5000/tcp sandbox-qsa-1 +b47085d9ad65 postgres:14-alpine "docker-entrypoint.s…" 5 days ago Up 9 seconds 0.0.0.0:5433->5432/tcp, :::5433->5432/tcp sandbox-postgres-1 77fa87641b42 opengisch/qgis-server:3.30-jammy "/bin/sh -c /usr/loc…" 2 hours ago Up 9 seconds 80/tcp, 9993/tcp sandbox-qgisserver-6 093346c82ea8 opengisch/qgis-server:3.30-jammy "/bin/sh -c /usr/loc…" 2 hours ago Up 9 seconds 80/tcp, 9993/tcp sandbox-qgisserver-8 afd95ccaef9e opengisch/qgis-server:3.30-jammy "/bin/sh -c /usr/loc…" 2 hours ago Up 9 seconds 80/tcp, 9993/tcp sandbox-qgisserver-7 diff --git a/docs/src/sandbox/inspect.md b/docs/src/sandbox/inspect.md index c465cfe..4129371 100644 --- a/docs/src/sandbox/inspect.md +++ b/docs/src/sandbox/inspect.md @@ -1,4 +1,4 @@ -# Sandbox : inspect QGIS Server instances +# Sandbox : introspection `qsa-cli` allows to inspect online QGIS Server instances registered to `qsa-api` server, but it's also possible to use the REST API. diff --git a/docs/src/sandbox/projects.md b/docs/src/sandbox/projects.md index f7758a5..a4fc2b8 100644 --- a/docs/src/sandbox/projects.md +++ b/docs/src/sandbox/projects.md @@ -1,4 +1,4 @@ -# Sandbox : manage projects +# Sandbox : projects ### Create and delete projects in PostgreSQL diff --git a/docs/src/sandbox/raster/layers.md b/docs/src/sandbox/raster/layers.md new file mode 100644 index 0000000..a86a0bc --- /dev/null +++ b/docs/src/sandbox/raster/layers.md @@ -0,0 +1,40 @@ +# Sandbox : raster layers + +Layer is based on the `landsat_4326.tif` file mounted in the Docker containers. + + +### Add layers + +To add a raster layer to a project: + +```` shell +$ curl "http://localhost:5000/api/projects/my_project/layers?schema=my_schema" \ + -X POST \ + -H 'Content-Type: application/json' \ + -d '{ + "crs": 4326, + "datasource":"/dem.tif", + "name":"dem", + "type":"raster" + }' +true +```` + + +### List layers and get metadata + +```` shell +$ curl "http://localhost:5000/api/projects/my_project/layers?schema=my_schema" +["polygons","dem"] +```` + + +### Map sample + +To execute a WMS `GetMap` request with basic parameters: + +```` shell +$ curl "http://localhost:5000/api/projects/my_project/layers/dem/map?schema=my_schema" --output map.png +```` + + diff --git a/docs/src/sandbox/layers.md b/docs/src/sandbox/vector/layers.md similarity index 95% rename from docs/src/sandbox/layers.md rename to docs/src/sandbox/vector/layers.md index 09a92cc..22bb0f5 100644 --- a/docs/src/sandbox/layers.md +++ b/docs/src/sandbox/vector/layers.md @@ -1,4 +1,4 @@ -# Sandbox : manage layers +# Sandbox : vector layers Layers are based on the `data.gpkg` file mounted in the Docker containers. @@ -35,6 +35,7 @@ $ curl "http://localhost:5000/api/projects/my_project/layers?schema=my_schema" \ true ```` + ### List layers and get metadata ```` shell @@ -66,7 +67,7 @@ To execute a WMS `GetMap` request with basic parameters: $ curl "http://localhost:5000/api/projects/my_project/layers/polygons/map?schema=my_schema" --output map.png ```` - + ### Delete layers diff --git a/docs/src/sandbox/styles.md b/docs/src/sandbox/vector/styles.md similarity index 95% rename from docs/src/sandbox/styles.md rename to docs/src/sandbox/vector/styles.md index ff8f925..2928a32 100644 --- a/docs/src/sandbox/styles.md +++ b/docs/src/sandbox/vector/styles.md @@ -1,4 +1,4 @@ -# Sandbox : manage styles +# Sandbox : vector styles ### Add style to project @@ -71,4 +71,4 @@ The layer rendering has changed now: $ curl "http://localhost:5000/api/projects/my_project/layers/polygons/map?schema=my_schema" --output map.png ```` - + diff --git a/sandbox/data.gpkg b/sandbox/data.gpkg index 9c20997..9ab91a1 100644 Binary files a/sandbox/data.gpkg and b/sandbox/data.gpkg differ diff --git a/sandbox/dem.tif b/sandbox/dem.tif new file mode 100644 index 0000000..efa17dd Binary files /dev/null and b/sandbox/dem.tif differ diff --git a/sandbox/docker-compose.yml b/sandbox/docker-compose.yml index 3ca551f..a864a95 100644 --- a/sandbox/docker-compose.yml +++ b/sandbox/docker-compose.yml @@ -3,7 +3,7 @@ services: qgisserver: image: opengisch/qgis-server:3.30-jammy volumes: - - ./landsat_4326.tif:/landsat_4326.tif + - ./dem.tif:/dem.tif - ./data.gpkg:/data.gpkg - ./projects/qsa:/io/data - ../qsa-plugin:/io/plugins/qsa @@ -21,7 +21,7 @@ services: context: .. dockerfile: sandbox/Dockerfile volumes: - - ./landsat_4326.tif:/landsat_4326.tif + - ./dem.tif:/dem.tif - ./data.gpkg:/data.gpkg - ./projects/qsa:/projects - ./pg_service.conf:/root/.pg_service.conf diff --git a/sandbox/landsat_4326.tif b/sandbox/landsat_4326.tif deleted file mode 100644 index c98cb6f..0000000 Binary files a/sandbox/landsat_4326.tif and /dev/null differ