Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add doc for raster layer in sandbox #16

Merged
merged 2 commits into from
Apr 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
9 changes: 5 additions & 4 deletions docs/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Binary file added docs/src/images/raster_dem_map.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions docs/src/qsa-api/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
21 changes: 14 additions & 7 deletions docs/src/qsa-api/endpoints.md
Original file line number Diff line number Diff line change
@@ -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"
````

Expand All @@ -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 |
Expand Down Expand Up @@ -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' \
Expand All @@ -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",
Expand All @@ -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 |
|---------|-----------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------|
Expand All @@ -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' \
Expand Down
1 change: 1 addition & 0 deletions docs/src/sandbox/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion docs/src/sandbox/inspect.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
2 changes: 1 addition & 1 deletion docs/src/sandbox/projects.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Sandbox : manage projects
# Sandbox : projects

### Create and delete projects in PostgreSQL

Expand Down
40 changes: 40 additions & 0 deletions docs/src/sandbox/raster/layers.md
Original file line number Diff line number Diff line change
@@ -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
````

<img src="../../images/raster_dem_map.png" width="300">
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Sandbox : manage layers
# Sandbox : vector layers

Layers are based on the `data.gpkg` file mounted in the Docker containers.

Expand Down Expand Up @@ -35,6 +35,7 @@ $ curl "http://localhost:5000/api/projects/my_project/layers?schema=my_schema" \
true
````


### List layers and get metadata

```` shell
Expand Down Expand Up @@ -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
````

<img src="../images/map.png" width="300">
<img src="../../images/map.png" width="300">


### Delete layers
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Sandbox : manage styles
# Sandbox : vector styles


### Add style to project
Expand Down Expand Up @@ -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
````

<img src="../images/map_style.png" width="300">
<img src="../../images/map_style.png" width="300">
Binary file modified sandbox/data.gpkg
Binary file not shown.
Binary file added sandbox/dem.tif
Binary file not shown.
4 changes: 2 additions & 2 deletions sandbox/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
Binary file removed sandbox/landsat_4326.tif
Binary file not shown.
Loading