MapIt!
-> Deutsch
   

Installation

MapIt can be installed in two ways:

For the test installation on Windows a installation routine (mapit-n.n-n.exe, see Download) is available. This will automatically unpack the archived files and create a program group for MapIt!. Afterwards, MapIt! can be launched with the corresponding entry in this program group. This installation uses the built-in web server of Python.

The general installation has no prerequisits for the web server or the system environment. This flexibility extends the installation process but should be still fairly simple. It it described in the following sections and is based on the contents of a MapIt! archive (mapit-n.n.tar.gz or mapit-n.n.zip, see Download).

Overview

In addition to MapIt! itself, you need a web-server, Python and the Python Imaging Library. See the Download-Page for more information on where to get this software.

A MapIt! installation consists of three parts: the CGI-code, the data (raster maps, HTML-templates and markers) and the icons that are needed by the generated HTML code.

Where the CGI-code and the icons have to be installed on your system depends on your web-server configuration. The data files can be installed anywhere (preferably outside of the public directory tree of your web-server), you only have to modify the configuration file accordingly.

Generic Installation Steps

Even though there are a variety of ways to hook MapIt! into your web-server such as CGI, Fast-CGI or mod_python, all front-ends share some installation and configuration steps which are described in this section. The front-end specific instructions are in the relevant sections below.

Install the Sources

Copy the sources to a suitable place. The sources are split into the base code (src/base) and the front-end code (src/frontends). The base code is needed by all front-ends, but you only need some of the files in src/frontend depending on the front end you want to use:

	Frontend	Files in src/frontends
	--------------------------------------
	CGI		showmap
			genmap

	FastCGI		showmap.cgi
			showmap.fcgi
			showmap.py
			genmap.cgi
			genmap.fcgi
			genmap.py
			fcgi.py

	mod_python	showmap.py
			genmap.py
			modmapit.py

Where to put these files is described in the front-end specific sections.

You can put the base files and the frontend files into the same directory (the easiest solution) or you can leave them in different directories. In the latter case you have to make sure that the front-end files can find the base files.

Install the Data Files

Install the Tile Data

Usually the tiles should be installed at a central place near to the web-server. On our system that's .../www-adm/tools/mapit/simple. You should place there everything from mapit-n.n/examples/simple except the icons/ subdirectory.

If the installation directory of MapIt! is accessable by the web-server, you may leave the example where it is.

Install the Icons

Copy the files in mapit-n.n/examples/simple/icons/ into a suitable directory for your web-server so that these will be accessible via an URL such as http://localhost:/mapit/simple/Icons.

The HTML generated by MapIt! refers to the icons with URLs of the form "/simple/Icons/image.png" by default. Please make sure that the icons can be reached by these URLs or modify the template files accordingly.

Configure MapIt!

Adapt mapconfig.py

Modify the configuration file mapconfig.py for your system. The most important entry that will have to be changed is the variable _base_dir, which points to the directory where you installed the data files.

If you use Windows, please note, that if you use backslashes (\) as directory delimiter, you have to double them, so that e.g. "C:\Programme\Mapit" becomes "C:\\Programme\\Mapit". However, it's easier to just use forward slashes (/) as delimiters.

If you have installed MapIt! into the predefined path and left the example data there, _base_dir could be set to e.g. c:/Programme/mapit/examples/simple.

Another Windows specific problem may be that some files use the Unix line ending conventions which Notepad does not understand. You can use Wordpad instead, but be sure to save the files as text files.

Adapt the HTML-Template

If necessary, adapt the HTML-template (examples/simple/simple.template (in the mapit archive)) to your needs. The most typical change are the links to the icons. A short explanation of the tags can be found in src/base/pagetemplate.py.

Installing MapIt! as CGI Script

Note that that MapIt! will be started by the webserver for each single request as a CGI-script. This will result in a performance lost because the whole MapIt! initialisation will be done for each request for the script. This methods is only recommended testing MapIt!

The MapIt! front-end scripts for CGI, showmap and genmap, have to be put into a directory that is configured for CGI in your web-server. For example, on our system it's .../www-adm/cgi-bin/mapit/simple.

Under Unix and under Windows if you use Apache you may have to modify the first line of the scripts to point to your python interpreter. For instance, on our NT-installation the looks like:

#!c:\programme\python\python -u -O

The -u flag under windows is important for the genmap script because it writes binary data to stdout.

Installing MapIt! as Fast CGI Script

This solution only works on Unix. Installing MapIt! as a FastCGI-Script(fcgi) will allow MapIt! to start up once and then answer several request. This speeds up processing significantly compared to the plain CGI script method. Check www.fastcgi.com for more general details on FastCGI.

There are two ways to get FCGI working. Note: You might to kill your running fcgi programs if you want them to reread the configuration files.

  1. Your webserver supports it directly. Then you have to check the server docs on how to do this. This is the best solution as most webserver can dynamically create or delete script fcgi processes meeting load demands. Just use the .fcgi variants of genmap and showmap then.
  2. Your webserver only supports cgi scripts. Then you can use the fcgi-cgi brigde program from the devkit available at www.fastcgi.com. The .cgi versions of showmap and genmap are normal CGI scripts that use fcgi-cgi as bridge and contains commands that invoke and connect to the workhorses showmap.fcgi and genmap.fcgi. To make this work on your system you will probably have to modify the paths in the .cgi files to your needs. You also have to make a change in one line in showmap.fcgi so that it will make sure that the .cgi variantes are called again next time.

Installing MapIt! with mod_python

mod_python is a module for the Apache web-server available from www.modpython.org. This is obviously an Apache only solution. The examples here come from a Windows NT installation, but it works just the same under Unix. It will also allow MapIt! to answer several request with one running process and it also adjusts dynamically to load demand, because there is one process per apache instance.

Copy the source files into a suitable directory, e.g. on our NT system that's C:/Programme/Apache Group/Apache/cgi-bin/mapit/, and configure this directory as follows in Apache's http.conf:

<Directory "C:/Programme/Apache Group/Apache/cgi-bin/mapit/">
	SetHandler python-program
	PythonHandler modmapit
	PythonDebug on
</Directory>
This tells Apache to call the handler function in modmapit for *all* URIs in that directory. modmapit knows how to recognize "showmap" and "genmap" in the URL and call the appropriate functions.

If you want, you can specify an alias for this directory with something like:

ScriptAlias /mapit-scripts/ "C:/Programme/Apache Group/Apache/cgi-bin/mapit/"
Now the URL http://localhost/mapit-scripts/showmap should display the HTML-page with the map.

   

MapIt!

Examples
Europe
Overview Berlin
City Map Berlin (a)
City Map Berlin (b)
City of Geyer (extern, german)

Download

»Installation

Installing Data

FAQ

Mailing-List

CVS

 
 
last modified:
Bernhard Herzog <bh@intevation.de>