Skip to content

PrimaGIS main site

Home » Documentation » Installation (Linux)

Installing PrimaGIS in Linux

Document Actions

This page provides steps for installing a base system in a Linux environment for PrimaGIS 0.5.0. Some of the notes may be Debian GNU/Linux centric, but it should be straight-forward to apply the steps in other distributions as well. Please refer to the PrimaGIS User Manual for additional information.

Mapserver and Python MapScript

Python Cartographic Library uses the Python bindings to MapServer's scripting interface called MapScript. This is the only way Mapserver is used by PCL (and thus PrimaGIS) and you do not need to install the MapServer CGI program.

In the examples in the following sections we will use $ (dollar sign) to symbolize a shell prompt and any following text something that you should type into your terminal.

Acquiring and compiling Mapserver / Mapscript

Download the latest MapServer release from http://ms.gis.umn.edu/download/current/ and unpack the source tree. We will refer to the location where the MapServer source is unpacked as $MAPSERVER.

Go to the $MAPSERVER directory and use the configure script to select the features you wish to compile into your build. Below is an example of a minimal configuration that will work with PrimaGIS. You may wish to modify it to better suit your needs. Use configure -help to learn about the available options.

$ ./configure --with-tiff --with-jpeg --with-png --with-freetype --with-zlib --with-threads \
--with-proj --with-gdal --with-wcs --with-ogr --with-wmsclient --with-wfsclient

You will need the development packages for the features you wish to build into MapServer. If you are running a Debian (or Debian based) distribution you can use apt-get to install the following packages.

  • python-dev
  • python-gdal
  • proj
  • libgd2-dev
  • libgdal1-dev
  • libtiff4-dev
  • libfreetype6-dev
  • libcurl3-dev

When all dependencies have been met and the configure script has been run successfully you can compile MapServer by running:

$ ./make

After MapServer has been compiled you still need to compile the Python Mapscript module that will be used by PCL. Use the following steps to accomplish this.

$ cd $MAPSERVER/mapscript/python
$ cp modern/* .
$ python setup.py install

Note to SVN users. Both MapServer and PCL use SWIG to generate the python bindings and it is imperative that the same version of SWIG is used in both. PCL releases come with generated wrappers that ensure compatibility with MapServer, but SVN versions require that you generate the wrappers yourself. For this reason it is better to use your own version of SWIG to generate the MapServer wrappers also. In this case use the following steps instead.

$ cd $MAPSERVER/mapscript/python
$ swig -python -modern -o mapscript_wrap.c ../mapscript.i
$ python setup.py install

After installing the MapScript module you can check your installation using the Python interpreter. If you have multiple python versions installed on your system remember to make sure that you are using the same one that Zope is using.

$ python

Python 2.3.5 (#2, May 4 2005, 08:51:39)
GCC 3.3.5 (Debian 1:3.3.5-12)] on linux2

Type ``help'', ``copyright'', ``credits'' or ``license'' for more information.
>>> import mapscript
>>> help(mapscript)

If the previous commands did not give any errors and the path to the mapscript module shown by the help command looks correct, then the MapServer installation was successful.

Creating a fontset file

When annotating your features you will most likely wish to use TrueType fonts. For this you will need to create a fontset file, which is a simple text file containing information about the fonts that are available on your system. You can also have only a subset of the available fonts listed in the fontset file, thus limiting PCL's access to only those fonts. Each line in a fontset file contains two parts: the font identifier and the path to the font file on your file system. Below is an example of a fontset file.

times_new_roman_bold_italic /fonts/Times_New_Roman_Bold_Italic.ttf
times_new_roman_bold /fonts/Times_New_Roman_Bold.ttf
times_new_roman_italic /fonts/Times_New_Roman_Italic.ttf
times_new_roman /fonts/Times_New_Roman.ttf
trebuchet_ms_bold_italic /fonts/Trebuchet_MS_Bold_Italic.ttf
trebuchet_ms_bold /fonts/Trebuchet_MS_Bold.ttf
trebuchet_ms_italic /fonts/Trebuchet_MS_Italic.ttf
trebuchet_ms /fonts/Trebuchet_MS.ttf

On a Debian system you can install the msttcorefonts package to get a set of usable TrueType fonts. Name the fontset file as fontset.txt and save it somewhere on your file system that is accessible by PCL.

PCL

Installing PCL is a simpler task than installing MapServer. First download the latest PCL release and unpack it on your file system. We will refer to the location where the PCL source tree is unpacked as $PCL. Pay attention to the $PCL/DEPENDENCIES.txt file and make sure that you have everything available on your system.

First edit the $PCL/PCL-Cartography/setup.py file and modify the the ms_home variable to point to the location of the MapServer source tree. After this you can install PCL by running

$ cd $PCL/PCL-Cartography
$ python setup.py install

Alternately, you can specify extra include paths to the setup.py build_ext target

$ cd $PCL/PCL-Cartography
$ python setup.py build_ext -I $MAPSERVER install

This will install both the cartography and the referencing modules. You can verify that PCL was successfully installed by running the python interpreter and trying to import the cartography module.

$ python

Python 2.3.5 (#2, May 4 2005, 08:51:39)
GCC 3.3.5 (Debian 1:3.3.5-12) on linux2

Type ``help'', ``copyright'', ``credits'' or ``license'' for more information.

>>> import cartography
>>> help(cartography)

If the previous commands did not give any errors and the path to the cartography module shown by the help command looks correct, then the PCL installation was successful. If you are upgrading from a previous installation please make sure that you do not have any .pyc or .pyo files lying around from older versions.

ZCO

Download the latest release and unpack it in your Zope instance's Products directory. Please make sure that the ZCO directory is named just ``ZCO'' and not something like ``ZCO-0.7''. Restart Zope and verify that Zope recognized ZCO in Control_Panel/Products using ZMI.

In order to get projection support for ZCO you also need to define a PROJ_LIB environment variable that points to the directory containing the EPSG database file. On Debian systems this is normally /usr/share/proj. You can modify the zopectl and runzope to include the variable to make sure that Zope is able to see it. Below is an example of a modified zopectl script.

#! /bin/sh
PYTHON="/usr/bin/python2.3"

ZOPE_HOME="/usr/lib/zope2.7"
INSTANCE_HOME="/var/lib/zope2.7/instance/primagis"
CONFIG_FILE="/var/lib/zope2.7/instance/primagis/etc/zope.conf"

SOFTWARE_HOME="/usr/lib/zope2.7/lib/python"
PYTHONPATH="$SOFTWARE_HOME"
PROJ_LIB="/usr/share/proj"

export PYTHONPATH INSTANCE_HOME SOFTWARE_HOME PROJ_LIB
ZDCTL="$SOFTWARE_HOME/Zope/Startup/zopectl.py" exec "$PYTHON" "$ZDCTL" -C "$CONFIG_FILE" "$@"

In order to avoid problems with case sensitive file names you should also symlink the epsg file to EPSG using the following command.

$ ln -s $PROJ_LIB/epsg $PROJ_LIB/EPSG

PrimaGIS

Download the latest release and unpack it in your Zope instance's Products directory. Restart Zope and verify that Zope recognized PrimaGIS in Control_Panel/Products using ZMI.

You should now see PrimaGIS also in your Plone site's portal_quickinstaller tool. Use the portal_quickinstaller to install PrimaGIS and check the installation log for any errors. If you are upgrading from a previous release, please remember to reinstall PrimaGIS using the portal_quickinstaller tool so that the migration code gets run.

zcologia
lautaportti
Recent Items
No items published or changed since your last log-in.