Code Monkey home page Code Monkey logo

qwc-print-service's Introduction

QWC Print service

API documentation:

http://localhost:5019/api/

Configuration

The static config files are stored as JSON files in $CONFIG_PATH with subdirectories for each tenant, e.g. $CONFIG_PATH/default/*.json. The default tenant name is default.

JSON config

  • JSON schema
  • File location: $CONFIG_PATH/<tenant>/printConfig.json

Example:

{
  "$schema": "https://raw.githubusercontent.com/qwc-services/qwc-print-service/master/schemas/qwc-print-service.json",
  "service": "print",
  "config": {
    "ogc_service_url": "http://localhost:5013/ows/",
    "qgis_server_version": "3.4.1",
    "print_pdf_filename": "qwc.pdf",
    "label_queries": [
      {
        "db_url": "postgresql:///?service=fachdaten",
        "query": "SELECT 'Bearbeiter/in: ' ||  vorname || ' ' || nachname FROM benutzer WHERE username = $username$",
        "params": [
          "NAME"
        ]
      }
    ]
  },
  "resources": {
    "print_templates": [
      {
        "template": "A4 hoch"
      }
    ]
  }
}

label_queries is a configuration for additional query parameters to inject into the WMS GetPrint request.

The contents is expected to be

{
  "label_queries": [{
    "db_url": "<db_url>",
    "query": "<query>",
    "params": ["<ParamName1>", ...]
  },{
    ...
  }],
}

where:

  • query is an arbitrary query, returning exactly one row. The $username$ placeholder can be used to inject the current username.
  • params is an array of parameter names to inject. The same number of parameters as number of returned values by the query must be specified.

Environment variables

Config options in the config file can be overridden by equivalent uppercase environment variables.

Variable Description
OGC_SERVICE_URL OGC Service URL
QGIS_SERVER_VERSION QGIS Server version (e.g. 2.18.19, 3.4.1)

Development

Create a virtual environment:

virtualenv --python=/usr/bin/python3 .venv

Activate virtual environment:

source .venv/bin/activate

Install requirements:

pip install -r requirements.txt

Set the CONFIG_PATH environment variable to the path containing the service config and permission files when starting this service (default: config).

export CONFIG_PATH=../qwc-docker/demo-config

Configure environment:

echo FLASK_ENV=development >.flaskenv

Start local service:

python server.py

qwc-print-service's People

Contributors

pka avatar manisandro avatar mwa avatar husseinkabbout avatar dependabot[bot] avatar

Forkers

elgohr-update

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.