Setup & Configure HSLayers Server components

For basig usage of HSLayers, HSProxy and StatusManager are needed. For advanced topics, OWSProxy, HSPrinter and warper are needed too.

HSProxy

HSProxy [project page] is Python script, which

  • deals as proxy for Ajax calls from JavaScript to various remote servers (used for Query, WMS, ...).
  • It also converts mimetypes of comming XMLs, to text/xml, so that browsers can read it.
  • Converts comming files from various encodings to UTF-8

Download

Use git:

git clone http://git.ccss.cz/hsrs/proxy.git

Install

Simple copy lib/hsproxy.py to your cgi-bin directory, e.g.:

cp proxy/lib/hsproxy.py /usr/lib/cgi-bin/hsproxy.cgi

Dependences

None special

Configure

Edit hsproxy.cgi, and adjust following variables:

  • LEVEL log level according to python logging package
  • allowedHosts list of allowed hosts, where the request can be directed to. Default is None: all hosts
  • encodings list of encodings, which will be used for conversion to, when input is text/xml

Note

In HSLayers JavaScript application, OpenLayers.ProxyHost must be set to /cgi-bin/hsproxy.cgi?url=

StatusManager

StatusManager [project page] is PHP script, which

  • Reads and writes state of the map (using PHP Session id), so that user, while page reloading, get’s the state, she got before leaving.
  • Is used as server-side file-handler. Often we need some data, to be offered to the user as file for downloading. Or user sends file, and we need to get it’s content. This simple script enables this javascript <–> file object connection.

Download

Use git:

git clone http://git.ccss.cz/hsrs/statusmanager.git

Install

Just copy index.php-template as index.php somewhere to htdocs directory:

mkdir /var/www/statusmanager/
cp statusmanager/index.php-template /var/www/statusmanager/index.php

Dependences

None special

Configure

First adjust path of the StatusManager library in index.php file and adjust path to the configuration file. In index.php it is:

# full path to downloaded StatusManager.php
include 'StatusManager.php';

# path to statusmanager.ini file
$statusManager = new StatusManager("statusmanager.ini");

Second, make copy statusmanager.ini-template file

cp statusmanager.ini-template statusmanager.ini

And adjust configuration in that file.

Note

In HSLayers JavaScript application, HSLayers.statusManagerUrl must be set to /statusmanager/index.php

OWSProxy

OWSProxy [project page] project is Python script, which

  • converts OGC OWS services (WCS, WFS) to OGC WMS
  • deals as warping proxy for those WMS services, which do not support map projection.

Download

Use git:

git clone git://git.ccss.cz/hsrs/owsproxy.git

Install

Copy owxproxy.cgi-template as owsproxy.cgi to your cgi-bin directory.

cp owsproxy.cgi-template /usr/lib/cgi-bin/owsproxy.cgi

Dependences

  • python-gdal
  • python-mapscript
  • python-pyproj
  • python-lxml

Configure

# - Adjust owsproxy.cgi, set propper OWSProxy path:

sys.path.append("path/to/owsproxy/")

# - Move owsproxy.cfg-template to owsproxy.cfg

# - Adjust path to the configuration file in owsproxy.cgi:

...
service = OWS.getService(configFile = "config.cfg")
...

Note

In HSLayers JavaScript application, HSLayers.OWS.owsProxyUrl must be set to /cgi-bin/owsproxy.cgi

HSPrinter

HSPrinter [project page] is Python script, which generates PDF, HTML and image files as with hardcopy maps. The server configurator has to create set of HTML Templates, which will be used for HTML and PDF output as well.

Download

Use git, download the printer:

git clone git://git.ccss.cz/hsrs/hsprinter.git

you also need pycommon package, which contains python-common files:

git clone git://git.ccss.cz/ccss/pycommon.git

For PDFs, get a copy of wkhtmltopdf from http://code.google.com/p/wkhtmltopdf/downloads/list

Dependences

  • python-mapscript
  • python-gdal
  • python-pil
  • python-mimetypes
  • python-uuid
  • python-pyproj
  • python-cssutils

Configure

Note

Fresh documentation should be available at http://redmine.ccss.cz/projects/hsprinter/wiki/Installation

Configure Apache Web Server

Export PYTHONPATH variable with pycommon, so that HSPrinter can find it. Add path to hsprinter.py in Apache web server configuration file:

Alias /hsprinter "/path/to/hsprinter/src/hsrs/hsprinter.py"
SetEnv PYTHONPATH /path/to/pycommon/src/

Add also cgi-handler to hsprinter directory:

<Directory "/path/to/hsprinter/src/hsrs/">
    AddHandler cgi-script .py
    Options +ExecCGI
    Allow from all
</Directory>

Configure HSPrinter

copy and adjust logging configuration file:

cp src/hsrs/logging.conf.default src/hsrs/logging.conf
$EDITOR src/hsrs/logging.conf

Do the same with hsprinter.cfg:

cp src/hsrs/hsprinter.cfg.default src/hsrs/hsprinter.cfg
$EDITOR src/hsrs/hsprinter.cfg

Note

In HSLayers JavaScript application, HSLayers.Print.printerUrl must be set to hsprinter/print