WMS with QGIS Server for OEREB data | Read-only mirror of https://github.com/sogis/oereb-wms — Kanton Solothurn. Issues & pull requests at the source.
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2023-03-02 17:44:14 +01:00
.github/workflows Fixup: No need to comment out VERSION env variable 2023-03-02 17:44:14 +01:00
conf start qgis v2 project file 2022-02-06 17:49:31 +01:00
qgis [oereb_wms] Anpassung Darstellung für Änderungen mit/ohne Vorwirkungen für Thema überlagerndeFläche und Sondernutzungspläne für Abnahme durch Bund. QGIS-File in Version 3.16 (#9) 2022-07-18 16:32:45 +02:00
qml [oereb_wms] Anpassung Darstellung für Änderungen mit/ohne Vorwirkungen für Thema überlagerndeFläche und Sondernutzungspläne für Abnahme durch Bund (#8) 2022-07-18 14:26:48 +02:00
tests trigger action 2022-06-09 16:54:30 +02:00
.gitignore add gitignore 2021-12-22 15:52:21 +01:00
docker-compose.test.yml fix test 2022-02-06 18:03:55 +01:00
docker-compose.yml test action 2 2022-02-06 19:41:51 +01:00
Dockerfile.qgisserver add test 2021-12-22 16:25:21 +01:00
Dockerfile.test add test 2021-12-22 16:25:21 +01:00
LICENSE Initial commit 2021-12-21 16:28:19 +01:00
README.md trigger action 2022-04-28 09:48:35 +02:00

oereb-wms

WMS server for OEREB-Kataster.

Achtung: Das linux/arm64-Image verwendet QGIS 3.10 aus dem Ubuntu-Repo. Im Ubuntugis-Repo gibt es keine linux/arm64-Pakete.

Achtung: Wenn wir WMS-Layer "in Änderung" erstellen werden, kann man schauen wie swisstopo die Namensgebung macht.

startup and shutdown

startup

docker-compose up --build

shutdown

ctrl-c
docker-compose down

The docker-compose down command makes sure the image is also set back into its original state, so one can run the import of the OEREB and AV data again without issues.

tests

Currently only the GetCapabilities command of both services is tested. See the "script" section in the corresponding main.yml file for the commands to manually run the tests.

The tests are in the bash script tests/test-wms.sh.

docker-compose -f docker-compose.test.yml build
docker-compose -f docker-compose.test.yml run test-qgis-server

explanations and usage

There are two versions of the WMS:

The first version is for creating legend entries with GetStyles and GetLegendGraphics. See http://github.com/sogis-oereb/oereb-iconizer.

The second version uses / is the production QGS file. The database connections are handled with a pg_service.conf file. The ones at hand are just for developing and testing use. In production there will be service file as secret (or similar). For developing (in QGIS Desktop) it's easiest at moment to use http://github.com/sogis-oereb/oereb-gretljobs. Setup the oereb database just you would develop some GRETL jobs. The wms tables are also based on an INTERLIS model. But they cannot be exported since there are some dirty tricks when creating them and putting them in the same schema (see http://github.com/sogis-oereb/oereb-db). Use pg_service_desktop.conf for QGIS Desktop: set an env var PGSERVICEFILE=/path/to/pg_service_desktop.conf in QGIS.

listing of all styles of a layer

http://localhost:8083/wms/oereb-symbols?SERVICE=WMS&REQUEST=GetStyles&LAYERS=ch.Grundwasserschutzzonen

getting the full legend of a specific layer

http://localhost:8083/wms/oereb-symbols?SERVICE=WMS&REQUEST=GetLegendGraphics&LAYERS=ch.Grundwasserschutzzonen&FORMAT=image/png

getting a single png image of a specific category of a specific layer

see also https://docs.qgis.org/3.16/de/docs/user_manual/working_with_ogc/server/services.html#getlegendgraphics

The following parameters are necessary:

  • SYMBOLWIDTH (mm)
  • SYMBOLHEIGHT (mm)
  • WIDTH (px)
  • HEIGHT (px)
  • LAYERTITLE (FALSE)
  • RULELABEL (FALSE)
  • DPI (96 for screens)
  • RULE (rule name can be extracted from the GetStyles response)

calculating the width in pixels

WIDTH=SYMBOLWIDTH/25.4*DPI

request with a RULE

The rule name needs to correspond with the content of the element se:Name/ as provided by the GetStyles response.

http://localhost:8083/wms/oereb-symbols?SERVICE=WMS&REQUEST=GetLegendGraphic&LAYERS=ch.Grundwasserschutzzonen&FORMAT=image/png&SYMBOLWIDTH=20&SYMBOLHEIGHT=10&WIDTH=76&HEIGHT=38&DPI=96&LAYERTITLE=FALSE&RULELABEL=FALSE&%20LAYERTITLE=FALSE&RULELABEL=FALSE&RULE=Grundwasserschutzzone%20S1

SLD fragment example

<StyledLayerDescriptor
    xmlns="http://www.opengis.net/sld"
    xmlns:xlink="http://www.w3.org/1999/xlink"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/sld http://schemas.opengis.net/sld/1.1.0/StyledLayerDescriptor.xsd"
    xmlns:se="http://www.opengis.net/se" version="1.1.0"
    xmlns:ogc="http://www.opengis.net/ogc">
    <NamedLayer>
        <se:Name>ch.Grundwasserschutzzonen</se:Name>
        <UserStyle>
            <se:Name>default</se:Name>
            <se:FeatureTypeStyle>
                <se:Rule>
                    <se:Name>Grundwasserschutzzone S1</se:Name>
                    <se:Description>
                        <se:Title>Grundwasserschutzzone S1</se:Title>
                    </se:Description>
                    <ogc:Filter
                        xmlns:ogc="http://www.opengis.net/ogc">
                        <ogc:PropertyIsEqualTo>
                            <ogc:PropertyName>artcode</ogc:PropertyName>
                            <ogc:Literal>S1</ogc:Literal>
                        </ogc:PropertyIsEqualTo>
                    </ogc:Filter>
                    <se:PolygonSymbolizer>
                        <se:Fill>
                            <se:SvgParameter name="fill">#003bb3</se:SvgParameter>
                        </se:Fill>
                        <se:Stroke>
                            <se:SvgParameter name="stroke">#0000b3</se:SvgParameter>
                            <se:SvgParameter name="stroke-width">1</se:SvgParameter>
                            <se:SvgParameter name="stroke-linejoin">bevel</se:SvgParameter>
                        </se:Stroke>
                    </se:PolygonSymbolizer>
                </se:Rule>
            </se:FeatureTypeStyle>
        </UserStyle>
    </NamedLayer>
</StyledLayerDescriptor>