docker

QWC MapInfo Service

Additional information at a geographic position displayed with right mouse click on map.

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.

MapInfo Service config

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

Examples:

{
  "$schema": "https://raw.githubusercontent.com/qwc-services/qwc-mapinfo-service/master/schemas/qwc-mapinfo-service.json",
  "service": "mapinfo",
  "config": {
    "db_url": "postgresql:///?service=qwc_geodb",
    "info_table": "qwc_geodb.ne_10m_admin_0_countries",
    "info_geom_col": "wkb_geometry",
    "info_display_col": "name",
    "info_title": "Country",
    "info_id": "country"
  }
}
{
  "$schema": "https://raw.githubusercontent.com/qwc-services/qwc-mapinfo-service/master/schemas/qwc-mapinfo-service.json",
  "service": "mapinfo",
  "config": {
    "db_url": "postgresql:///?service=qwc_geodb",
    "info_table": "qwc_geodb.ne_10m_admin_0_countries",
    "info_geom_col": "wkb_geometry",
    "info_display_col": "name",
    "info_title": "Country",
    "info_id": "country",
    "info_where": "pop_est > 600000"
  }
}
{
  "$schema": "https://raw.githubusercontent.com/qwc-services/qwc-mapinfo-service/master/schemas/qwc-mapinfo-service.json",
  "service": "mapinfo",
  "config": {
    "queries": [
      {
        "db_url": "postgresql:///?service=qwc_geodb",
        "info_table": "qwc_geodb.ne_10m_admin_0_countries",
        "info_geom_col": "wkb_geometry",
        "info_display_col": "name",
        "info_title": "Country",
        "info_id": "country"
      },
      {
        "db_url": "postgresql:///?service=qwc_geodb",
        "info_sql": "SELECT type FROM qwc_geodb.ne_10m_admin_0_countries WHERE ST_contains(wkb_geometry, ST_SetSRID(ST_Point(:x, :y), :srid)) LIMIT 1",
        "info_title": "Type",
        "info_id": "type"
      },
      {
        "db_url": "postgresql:///?service=qwc_geodb",
        "info_sql": "SELECT abbrev, postal, subregion FROM qwc_geodb.ne_10m_admin_0_countries WHERE ST_contains(wkb_geometry, ST_SetSRID(ST_Point(:x, :y), :srid)) LIMIT 1",
        "info_title": ["Abbreviation", "Postal Code", "Subregion"],
        "info_id": "region"
      }
    ]
  }
}

Environment variables

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

Permissions

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

Example:

{
  "$schema": "https://raw.githubusercontent.com/qwc-services/qwc-services-core/master/schemas/qwc-services-permissions.json",
  "users": [
    {
      "name": "demo",
      "groups": ["demo"],
      "roles": []
    }
  ],
  "groups": [
    {
      "name": "demo",
      "roles": ["demo"]
    }
  ],
  "roles": [
    {
      "role": "public",
      "permissions": {
        "mapinfo_query": [
          "country",
          "type",
          "region"
        ]
      }
    },
    {
      "role": "demo",
      "permissions": {
        "mapinfo_query": []
      }
    }
  ]
}

Run locally

Install dependencies and run:

export CONFIG_PATH=<CONFIG_PATH>
uv run src/server.py

To use configs from a qwc-docker setup, set CONFIG_PATH=<...>/qwc-docker/volumes/config.

Set FLASK_DEBUG=1 for additional debug output.

Set FLASK_RUN_PORT=<port> to change the default port (default: 5000).

Docker usage

The Docker image is published on Dockerhub.

See sample docker-compose.yml of qwc-docker.

Testing

Run all tests:

python test.py