Components
The server code is the package gws in app/gws. Each package links to its API documentation, built with make.sh doc-api.
Framework
| Package | Contents |
|---|---|
gws | Basic types and the interfaces of all components, generated from the .pyinc files of the packages. Every module imports it with import gws. |
config | Reads configuration files in all supported formats, validates them against the specs, builds the object tree, stores it and loads it in the worker processes. gws.config.util has helpers that configure common children, like templates, models and finders. |
core | The object tree implementation behind gws.Node and gws.Root. Also general utilities (gws.u), logging (gws.log), debugging helpers (gws.debug), constants such as system paths and role names (gws.c), and environment variables (gws.env). |
ext | The decorators that register extension types and commands. They do nothing at runtime, the spec generator reads them from the source. |
server | Configuration and control of the embedded servers (nginx, uWSGI, rsyslog), the gws server commands, the monitor that reloads the server on configuration changes, and the spooler for background jobs. |
spec | The spec generator, which parses the source code, and the spec runtime, which validates configurations and requests, converts special types and imports extension classes on demand. |
test | The test runner behind make.sh test, the in-container runner, the mock HTTP server and the utilities used in tests. |
Base
gws.base contains the core components. They are always loaded, and most of them define a base class that plugins extend.
| Package | Contents |
|---|---|
action | The base action class and the action manager, which finds the action for a command, validates the request and checks permissions. Also the gws action CLI commands. |
application | The application object, the first node of the tree. It configures all global components in a fixed order and holds the managers, like actionMgr, authMgr or databaseMgr. |
auth | Users and roles, the authorization manager, base classes for authentication methods (how credentials arrive), providers (where users come from), multi-factor adapters and sessions. |
client | The configuration of the client UI: which elements (toolbar buttons, sidebar tabs, and so on) a project shows, and their options. |
database | Database providers and connections (SQLAlchemy), and base classes for database-backed layers, models and user sources. |
edit | The edit action, which lets the client list, create, update and delete features of editable models. |
exporter | Exporters that write features to files, the export worker and the exporter action. |
feature | The feature object: attributes, geometry, the raw source record and the views rendered by templates. |
grabber | Raster images for layers: fetches them from sources, aligns them to tile grids, reprojects them and caches tiles. |
job | The job manager: creates jobs, stores their state in sqlite, runs them in the spooler and reports their status and results. |
layer | The base layer class, layer groups, base classes for raster and vector layers, and the configuration of layer trees from source layers. |
legend | The base legend class, which renders a legend for a layer, and functions to combine several legends into one image. |
map | The map object, which defines the coordinate system, extent and resolutions of a project, and the map action, which renders images, tiles, legends and features of layers. |
metadata | Metadata of projects, layers and services, based on ISO 19115 and the OGC service standards, with INSPIRE support. |
model | Data models and fields: reading features from a source, converting them for the client, and validating and writing them back. The module docstring describes the data flow. |
ows | OGC web services. ows.client parses capabilities and queries WMS, WFS and WMTS sources. ows.server implements WMS, WMTS, WFS and CSW services for configured projects. |
printer | Printers and the print worker, which renders a map and a template into a PDF or image in a background job. |
project | Projects: a map, a client configuration and project-specific actions, finders, models, templates and printers. Also the projectInfo command, which sends a project to the client. |
search | The search manager, which runs a search query over all finders a user can access, and the base finder class. Finders search layers, models or external services. |
shape | Geometries in a coordinate system, based on Shapely, with conversions from and to WKT, WKB, GeoJSON and extents. |
storage | A key-value store where the client saves user data, like selections or annotations, by category. Storage providers implement the backend. |
template | The base template class and the template manager, which finds a template by subject (for example feature.label) along the tree. |
web | Web sites with their rewrite rules, CORS and SSL settings, request parsing (gws.WebRequester), the WSGI application and the web action for assets, pages and downloads. |
GIS
| Package | Contents |
|---|---|
cache | Tile cache management: status, seeding, cleanup, and the gws cache commands. |
render | Renders a map view from layers into raster and SVG planes, and combines them into an image or HTML. Used by map and print templates and by OWS services. |
source | Utilities for source layers, the layers of an external source like a WMS service or a QGIS project: filtering and combining their extents and coordinate systems. |
zoom | Computes resolutions and scales for maps and layers from the zoom configuration. |
Libraries
gws.lib contains libraries that do not depend on the object tree.
| Package | Contents |
|---|---|
bounds | Extents with a coordinate system: transforming, combining, buffering. |
cli | Helpers for command line scripts. |
cql | CQL2 filter expressions. |
crs | Coordinate systems: lookup by code or name, axis order, transformations. |
datetimex | Dates, times, time zones and durations. |
dynimport | Importing modules from file paths, used for extension classes and plugins. |
extent | Plain extents: parsing, intersecting, computing centers and sizes. |
font | Font installation for rendering. |
gdalx | A wrapper around GDAL and OGR for raster and vector files. |
gml | GML parsing and writing. |
grid | Tile grids: resolutions per level, tile ranges for an extent. |
htmlx | HTML rendering to PDF or PNG with wkhtmltopdf. |
image | Images, a wrapper around Pillow. |
inifile | Reading and writing ini files. |
intl | Locales and formatting of dates, times and numbers. |
jsonx | Reading and writing JSON. |
mapserver | Raster rendering with MapServer. |
mime | MIME types. |
net | HTTP requests and URL handling. |
osx | Running commands and working with files and processes. |
otp | One-time passwords (HOTP, TOTP) for multi-factor authentication. |
password | Password hashing, checking and generation. |
pdf | PDF utilities: merging, overlaying, converting pages to images. |
sa | SQLAlchemy imports in one place. |
sqlitex | A wrapper around the SQLite driver. |
style | Feature styles: parsing CSS-like style values and icons. |
svg | Building SVG fragments from shapes and styles. |
uom | Units of measure: pixels, millimeters, scales and resolutions. |
watcher | File system watcher used by the monitor. |
xmlx | XML parsing, building and serialization, with namespace handling. |
zipx | Creating and extracting zip archives. |
gws.lib.vendor contains third-party code that is not installed with pip, for example jump (templates), slon (the configuration notation), dog (documentation) and umsgpack (msgpack).
Plugins
gws.plugin contains the optional components. Each plugin package implements one or more extension types, for example layer types, database and OWS providers, authentication methods, model fields, templates or client tools. A plugin is loaded only if the configuration uses one of its types. External plugins, listed in the manifest, work the same way, see Plugins and extension types.