RAPC Administration Guide

Maher Abdel Karim

Baha' Al-Faqih


Table of Contents

1. Introduction
1.1. Typographic Conventions
1.2. UML
1.3. Deployment
2. Requirements
2.1. Hardware
2.2. Software
2.2.1. Operating System
2.2.2. PostGIS
2.3. Folder Structure
2.4. Administrator
3. Concepts
3.1. Services
3.2. Windows Users
3.3. PostgreSQL users
3.4. Translation System
3.4.1. Gettext
3.4.2. The dcmmstranslation() Function
3.5. Mailing Lists
4. Installation
4.1. Windows Installation
4.1.1. Apache
4.1.2. PHP
4.1.3. PostgreSQL
4.1.4. PostGIS
4.1.5. RAPC
4.2. Manual Installation
4.2.1. PostgreSQL
4.2.2. PostGIS
4.2.3. PostArabic
4.2.4. Apache
4.2.5. PHP
4.2.6. Mapserver
4.3. Default Accounts
4.4. Checklist
4.5. Optional Tools
4.5.1. Active Perl
4.5.2. GIX
4.5.3. poEdit
5. Configuration
5.1. Configuration Files
5.2. Custom Map
5.2.1. PostGIS Layers
5.3. Plug-Ins
5.3.1. Identify Plug-Ins
6. Administration
6.1. GIS Data Loading
6.1.1. Shapefile Loader
6.1.2. shp2pgsql
6.2. Recurring Tasks
6.2.1. Backup
6.2.2. Restore
6.2.3. Removing Temporary Files
6.2.4. Quality Control
6.3. Security
7. Troubleshooting
7.1. RAPC Info Mailing List
7.2. PostgreSQL Database Server Service
7.2.1. PostgreSQL Database Server Service Fails to Start
7.3. Map Display
7.4. Restore
7.5. File Upload Fails
7.6. Unable to Load Dynamic Library
7.7. Log Files
7.8. Htdig

1. Introduction

While it is possible to run RAPC on other operating systems, this document focuses on the RAPC administration under Windows.

1.1. Typographic Conventions

A "\" at the end of the line in program listings means that the line continues in the next line.

1.2. UML

This document uses Unified Modeling Language (UML) diagrams to illustrate various aspects of the RAPC application.

For those not familiar with the UML symbology, Figure 1, “UML Legend” provides a basic UML legend.

UML Legend

Figure 1. UML Legend

1.3. Deployment

The RAPC application can be installed in a stand-alone setup or in a client-server environment.

Stand-Alone Deployment

Figure 2. Stand-Alone Deployment

Client-Server Deployment

Figure 3. Client-Server Deployment


The RAPC application is meant to run in an intranet environment. If you want to use the application over the internet you should protect it by a proper firewall and/or VPN setup. To run the application directly on an internet server would require a complete security audit of the application code.

Regardless of the type of installation, it is important that the administrator stays up-to-date with the latest Apache, PostgreSQL, Windows and PHP releases to avoid security leaks.

Internet Deployment

Figure 4. Internet Deployment

In addition to the outlined approach it might be possible to run a RAPC on server on the internet if it is hardened with SSL and additional access control on the Apache side (E.g. client-side certificates).

2. Requirements

This section describes the hard- and software requirements of the RAPC application.

2.1. Hardware

A PC with at least 256 MB RAM and at least 1 GHz CPU speed.

The actual hardware requirements might be higher depending on the size and nature of the map data as well as the number of concurrent users.

To print the forms, a printer with at least 300dpi resolution is required

2.2. Software

The following software packages are required to run the RAPC application:

  • PostgreSQL

  • PostGIS

  • Apache (Other web servers will also work)

  • PHP

  • The following PEAR modules:

    • DB

    • DB_DataObject

    • DB_DataObject_FormBuilder

    • Date

    • HML_Common

    • HTML_QuickForm

    • HTML_QuickForm_Controller

    • HTML_QuickForm_SelectFilter

    • HTML_Table

    • Image_Color

    • Image_Graph

    • Log

    • Pager

  • Mapserver (PHP Mapscript)

  • Web browser

Section 4, “Installation” covers the installation of all required software packages.

If it is intended to use the Arabic interface of the RAPC application, the PostArabic software package is required in addition.

2.2.1. Operating System


While it might be possible to install the RAPC server on other Windows flavors, only Windows 2003 Server and Windows XP are recommended.

The filesystem of c: must be NTFS and not FAT.

Windows 2000 installations have been tested and should work. Windows NT, 95, 98 are ME not recommended.

Installation of RAPC on other operating systems such as Linux may require minor changes to the source code. Please contact the RAPC developers if you are having problems. The initial RAPC version was created on Windows.

2.2.2. PostGIS

At least PostGIS 1.0.3 (lwpostgis.sql) is required to run RAPC without adjustments to the source code.

It is recommended to use at least PostGIS 1.0.3 or higher.

2.3. Folder Structure

On Windows, the following folders contain files that belong to the standard RAPC installation:

+ c:
+--+ Program Files	
|  |
|  +--+ Apache Group
|  |  |
|  |  +--- Apache2
|  |  |
|  +--+ rapc
|  |  |
|  |  +--- config
|  |  |
|  |  +--- doc
|  |  |
|  |  +--- data
|  |  |
|  |  +--- plugin
|  |
|  +--+ PostgreSQL
|     |
|     +--+ 8.0
|        |
|        +--- data
+--+ tmp 
|  |
|  +--- ms_tmp
+--+ windows
   +--- fonts
   +--- php


Note that your actual folder structure might be different, e.g. when you use a Non-English version of Windows XP. Use the structure above as a reference when you're not sure where to install things.


If you are installing manually, you should install the software to the above mentioned folders.

The PostgreSQL folder holds the PostgreSQL installation, the Apache2 folder the Apache webserver and the php folder the PHP installation. The tmp folder holds temporary files (e.g. PHP session information) and the ms_tmp folder contains temporary map files created by mapserver.

For most of the software packages these folders are the default on a system with an English version of the Windows operating system. The folders will be created during the installation process described below.

c:\Program Files\rapc\config contains all configuration files..

c:\Program Files\rapc\doc contains the documentation in various formats: CHM, DocBook XML, HTML, PDF.

c:\Program Files\rapc\data contains GIS data (shape files) used by the application. However this location is not fixed and may be overridden in the map file.

c:\Program Files\rapc\plugin contains application plug-ins (extensions that extend the functionality).

2.4. Administrator

Basic computer knowledge together with this guide should be sufficient to administer a stand-alone installation.

Any administrator will benefit from knowledge in SQL, PostgreSQL, the Windows command line interface (cmd.exe), Windows user administration, Windows services, GIS (e.g. ArcView), mailing lists - however such knowledge is not a requirement.

Various support possibilities are available to support new administrators.

3. Concepts

This section outlines important concepts that are relevant to the RAPC administration.

3.1. Services

This section introduces Windows services.

Apache and PostgreSQL run as Windows services.

To open the Services Panel, open the Control Panel from the Start Menu as shown in Figure 5, “Control Panel”.

Control Panel

Figure 5. Control Panel

In the Control Panel, click on the following icon:

Open the Services Panel by clicking on the this shortcut:

The Services Panel is displayed in Figure 6, “Services Panel”.

Services Panel

Figure 6. Services Panel

The Status column shows the services that are currently running. In Figure 6, “Services Panel” is running ("Started") while the Removable Storage is not running (empty Status column).

To start a service, click on the button.

To stop a service, click on the button.

In both cases, verify the success in the Status column of the service list.

For additional information on Windows services, consult your Windows documentation.

3.2. Windows Users

Important information on Windows user accounts.

Windows Users

Figure 7. Windows Users

Figure 7, “Windows Users” shows users that are important for the RAPC administration. Note that the unpriviledged users account to operate RAPC are omitted.

For additional information on Windows user accounts, consult your Windows documentation.


While the Windows user accounts "system" and "postgres", you don't have to know their passwords.


The name of the Windows user account to run the PostgreSQL database service (default: postgres) can be changed during the PostgreSQL installation.

3.3. PostgreSQL users

Introduction to PostgreSQL user management.

PostgreSQL Users

Figure 8. PostgreSQL Users

Figure 8, “PostgreSQL Users” shows PostgreSQL users that are important for the RAPC administration. Windows users and system boundaries are shown to clarify the relationships.

The PostgreSQL documentation which you can access e.g. through the Start Menu (after PostgreSQL installation) or on the PostgreSQL website contains additional information on PostgreSQL user management.


Don't get confused by the two "postgres" accounts: Even though they have the same name, they are different things, one lives inside PostgreSQL and one inside Windows. You don't have to know the password of the Windows account "postgres" (The PostgreSQL intaller is creating a long, random password for it), but you have to know the password of the PostgreSQL account "postgres".

Please follow the PostgreSQL installation instructions carefully (Section 4.1.3, “PostgreSQL”).

3.4. Translation System

If you are going to use RAPC in more than one language and would like to use the RAPC translation system for your data, you should read this section.

RAPC is actually using the GNU gettext for text that occurs in the PHP sources .

Both gettext will fall back to the two letter ISO language code in case no translation is found for the five letter code (E.g. the "ar" translation is returned if "ar_JO" was requested and no translation was found).

3.4.1. Gettext

GNU gettext is a widely used system for translation management.

RAPC is using the PHP gettext extension, the translations are edited in the locale/*/LC_MESSAGES/rapc.po files. Replace "*" with a two letter ("ar") or five letter ("ar_JO") language code.

In order to be used by gettext, the source files (rapc.po) files have to be compiled to rapc.mo files.

Editing and compilation is conveniently done with poEdit (Section 4.5.3, “poEdit”). poEdit is also capable of extracting the translation terms from PHP sources.

Messages that have to be translated but are not included in the PHP sources should be added to include/i18n.php. This is the case e.g. for coded values from the database.

3.4.2. The dcmmstranslation() Function

Messages residing in the PostgreSQL database should be internationalized using the dcmmstranslation().

The dcmmstranslation() function looks up translations from the Translation table.

The name field of the AdministrativeArea, Landmark and Village should contain the name in the primary language that is used to operate the application. E.g. in the case of landmarks, this is the field that is filled and used if no other translation is given. Additional translations are stored in the translation table.

The shapefile loader (Section 6.1.1, “Shapefile Loader”) allows to update the translation table from fields like name (English), arname (Arabic), etc.

To use translations, e.g. in map files, use the following statement:

dcmmstranslation('en', name)
where 'en' is the ISO code of the language you want to use.

If no matching translation is found in the translation table, the term to translate is returned by dcmmstranslation().

3.5. Mailing Lists

Mailing lists are automated distribution systems for emails.

Feature request, and bugs can be sent directly to the following email

The majority of the software products mentioned in this document offer a multitude of mailing lists to keep users and administrators updates about the latest releases as well as potential security issues.


If you are not familiar with mailing lists yet, take the time to familiarize with the techniques to subscribe and to post to them.

4. Installation

This section outlines several installation options for the RAPC application.


The manual installation instructions will also work on operating systems like Linux.


Please report all RAPC installation problems in order to allow the developers to further enhance the installation process.

Any remarks can be sent directly to the following email

4.1. Windows Installation

How to install RAPC on Windows XP Professional or Windows 2003 Server.

Please contact the RAPC developers if you are looking for a RAPC CD release.

All installers mentioned below area available in the setup folder of the CD.

4.1.1. Apache


If you are running Skype, you may want to shutdown Skype while you are installing Apache as Skype might otherwise prevent Apache from using port 80.


If the Apache installation is not fully successful because another program (e.g. IIS) is already using port 80, simply edit httpd.conf to use another port (e.g. "Listen 81" instead of "Listen 80" and run the Apache setup again. Choosing the repair option will complete the Apache installation.

Run the Apache installer. The Apache installer is available from the setup folder of the RAPC CD or from the Apache website: http://httpd.apache.org.

Apache Wizard

Figure 9. Apache Wizard

In the Apache installer welcome page, click Next > (Figure 9, “Apache Wizard”).

Apache License

Figure 10. Apache License

Select I accept the terms in the license agreement and click Next > (Figure 10, “Apache License”).

Apache Readme

Figure 11. Apache Readme

Read through the information in Figure 11, “Apache Readme” and click on Next >.

Apache Information

Figure 12. Apache Information

Fill in the fields Network Domain (The domain of your Organization), Server Name (The name of your RAPC server) and Administrator's Email Address (Your email address). Verify that the option for All Users, on Port 80, as a Service is selected and click Next > (Figure 12, “Apache Information”).

Apache Setup Type

Figure 13. Apache Setup Type

Verify the selection in Figure 13, “Apache Setup Type” and click Next >.

Apache Location

Figure 14. Apache Location

Make sure that the Destination Folder is C:\Program Files\Apache Group and click Next >.


The RAPC installer reads the Apache installation folder from the Windows registry. You can install Apache to different locations.

Apache Install

Figure 15. Apache Install

In the dialog shown in Figure 15, “Apache Install”, click Install.


If the Apache installation fails because another application is using port 80, you can use the following commands to find out which application is using port 80:

netstat -aon
Look for the process id (PID) of the process occupying port 80 and find the application of the process id.

4.1.2. PHP

Run the DCMMS Scripting installer. The installer is available from the setup folder of the CD or from the DCMMS website: http://dcmms.sourceforge.net.

PHP License

Figure 16. PHP License

Click I Agree if you agree to the license (Figure 16, “PHP License”).

PHP Components

Figure 17. PHP Components

Click Next >.


PEAR modules can be easily installed and upgraded over the internet. See the PEAR documentation for details. However, the DCMMS scripting installer provides all necessary packages.

PHP Location

Figure 18. PHP Location

Accept the default installation directory, c:\windows\php, by clicking Install (Figure 18, “PHP Location”).

4.1.3. PostgreSQL

This section describes how to install PostgreSQL for Windows.

The PostgreSQL installer (postgresql-8.0.msi) is available from the setup folder of the RAPC CD or from http://pgfoundry.org/projects/pginstaller/.


Don't get confused by the two PostgreSQL installer files. They are both required and can only be installed together.

Run the PostgreSQL installer and select the English language.

PostgreSQL Language Selection

Figure 19. PostgreSQL Language Selection

Click Start > to begin the Installation

PostgreSQL Setup

Figure 20. PostgreSQL Setup

Click Next >.

Installation Notes

Figure 21. Installation Notes

Press Next > after reading the installation instructions.

Choose Installation Options

Figure 22. Choose Installation Options


Click on the icon next to "PostGIS Spatial Extensions" and select Will be installed on local hard drive.


Instead of installing PostGIS with the PostgreSQL installer, you should install a newer version from a separate installer (at least version 1.0.3). Such an installer is available from http://www.webbased.co.uk/mca/ or from the setup folder of the RAPC CD.

Once PostgreSQL 8.1 is released, the PostGIS version included in the PostgreSQL installer will be sufficient.

Note that the PostgreSQL installation path is not important. Please accept the default installation path provided by the installer.

Accept the other settings as shown in Figure 22, “Choose Installation Options” and click Next >.

Service Configuration

Figure 23. Service Configuration

Accept the default settings as shown in Figure 23, “Service Configuration” and click Next >. Instead of "Z1027" your installer will show the name of your computer.

Account Error

Figure 24. Account Error

Select Yes.


Figure 25. Password

Accept the random password by clicking OK.


You don't have to remember the random password. It is only used internally to run the PostgreSQL service on Windows. See Section 3, “Concepts” for detailed information.

Successfully granted the 'Logon as a service' right

Figure 26. Successfully granted the 'Logon as a service' right

Click on OK.

Initialise Database Cluster

Figure 27. Initialise Database Cluster

Accept the default settings as shown in Figure 27, “Initialise Database Cluster” and choose an appropriate password for the PostgreSQL superuser "postgres". Enter the password to the Password and Password (again) fields then click Next >.


You'll need this password (for the PostgreSQL superuser "postgres") later on during the installation process e.g. while running the RAPC setup and for database maintenance purposes. Make sure that you remember it well.

Enable Procedural Languages

Figure 28. Enable Procedural Languages

Accept the default settings as shown in Figure 28, “Enable Procedural Languages”. Make sure that "PL/pgsql" is selected. Click Next >.

Enable Contrib Modules

Figure 29. Enable Contrib Modules

Accept the default selection as shown in Figure 29, “Enable Contrib Modules” and click Next >.

Enable PostGIS

Figure 30. Enable PostGIS

As shown in Figure 30, “Enable PostGIS”, leave the option Enable PostGIS in template1 unchecked and click Next >.

PostGIS will be enabled for the rapc database by the RAPC installer.

Ready to Install

Figure 31. Ready to Install

As shown in Figure 31, “Ready to Install”, PostgeSQL can be installed now. Click Next >.

Installation complete

Figure 32. Installation complete

Click Finish.


As mentioned in Figure 32, “Installation complete”, it is recommended to subscribe to the pgsql-announce mailing list to stay up-to-date with the latest PostgreSQL developments.

4.1.4. PostGIS

Once the PostgreSQL setup has finished, start the PostGIS setup which is available in the setup folder of the CD or on the internet: http://www.webbased.co.uk/mca/.

PostGIS License

Figure 33. PostGIS License

Click on I Agree if you agree to the PostGIS license in Figure 33, “PostGIS License”.

PostGIS Components

Figure 34. PostGIS Components


Uncheck the option Create Database as shown in Figure 34, “PostGIS Components” and click Next >.

The rapc database will be created by the RAPC installer.

PostGIS Location

Figure 35. PostGIS Location

Accept the default settings as shown in Figure 35, “PostGIS Location” and click Next >.


The destination folder is your PostgreSQL installation folder and might differ from the one shown in Figure 35, “PostGIS Location”

PostGIS Database Connection

Figure 36. PostGIS Database Connection

Accept the default settings as shown in Figure 36, “PostGIS Database Connection” and enter the password you have chosen for the PostgreSQL superuser "postgres" (Section 4.1.3, “PostgreSQL”). Click Install.

Installation Complete

Figure 37. Installation Complete

Click Close

4.1.5. RAPC

Start the RAPC Setup, which is available from the setup folder of the RAPC CD .

RAPC License

Figure 38. RAPC License

Click on I Agree if you agree to the license shown in the license dialog (Figure 38, “RAPC License”).

RAPC Components

Figure 39. RAPC Components

Select all RAPC components except Update as shown in Figure 39, “RAPC Components” and click Next >.

RAPC Location

Figure 40. RAPC Location

Accept the default installation path, c:\program files\rapc, as shown in Figure 40, “RAPC Location” and click Next >.

RAPC Database Connection

Figure 41. RAPC Database Connection

Enter the PostgreSQL superuser "postgres" password (As entered in Figure 27, “Initialise Database Cluster”). Click Install.

You should now be able to start the RAPC from the Start Menu or through the shortcut on the Desktop. Note that the full functionality will only be available once you've completed the data set, e.g. by loading the sample data.


The installer will not overwrite existing RAPC configuration files.

4.2. Manual Installation

How to install RAPC manually.


This section might be useful only for installations on non-Windows platforms and for developers who are interested in the details of the RAPC installation process.


The RAPC installer sources (e.g. rapc.nsi) may contain additional helpful information on the installation process.


The following expects that various PostgreSQL binaries, such as psql.exe or createlang.exe are in the PATH. If necessary, you have to change your PATH environment variable to include the bin folder of your PostgreSQL installation.

4.2.1. PostgreSQL

The PostgreSQL database is available from http://www.postgresql.org.

The PostgreSQL installation should support UNICODE.


You may run into problems if you use a binary PostgreSQL distribution under Linux or UNIX. In order to use PostGIS and specifically GEOS from PostgreSQL, the binaries have to be linked against libstc++. The PostGIS documentation contains details regarding this issue.

In order to enforce RAPC logins with password authentication, the pg_hba.conf configuration file should be altered like in the following example:

host    all         postgres   trust
host    rapc       all   password

Note that this still allows the PostgreSQL superuser postgres to connect to PostgreSQL server without authentication. However the user postgres is not allowed to log on to RAPC.


The instructions below assume that the PostgreSQL administrator is named postgres and that the postmaster is running on the local machine (localhost). If this is not the case for you, you'll have to adjust the commands accordingly. The same applies to the connection method - if your postmaster is not configured to accept TCP/IP connections, you have to adjust the commands (and possibly the RAPC configuration).

Create a new database named rapc using UNICODE, load the PL/SQL language to the database:

createdb -U postgres -h localhost --encoding=UNICODE rapc
createlang -U postgres -h localhost plpgsql rapc 

If PL/SQL was created in template1, the second command will fail. Ignore the error message in this case.

4.2.2. PostGIS

PostGIS is available from http://postgis.refractions.net .

Follow the installation instructions in the PostGIS documentation.

Once PostGIS is installed, change to the directory containing postgis.sql and spatial_ref_sys.sql and load PostGIS to the rapc database:

psql -U postgres -h localhost -f postgis.sql rapc
psql -U postgres -h localhost -f spatial_ref_sys.sql rapc

4.2.3. PostArabic

PostArabic is a small module that adds Arabic shaping functionality to PostgreSQL.


The PostArabic installation is only required in order to display Arabic map labels. If you are not interested in Arabic map labels, you can skip the PostArabic installation.

Follow the installation instructions in the file README.arabic.

Change to the directory containing arabic.sql and load PostArabic to the rapc database:

psql -U postgres -h localhost -f arabic.sql rapc

4.2.4. Apache

The Apache webserver is available from http://httpd.apache.org .

Follow the installation instructions in the Apache documentation.

Apache is configured through the httpd.conf file. In order to access the RAPC application by a convenient URL like http://localhost/rapc/, you should add lines like the following to httpd.conf:

Alias /rapc "c:/program files/rapc/"
<Directory "c:/program files/rapc">
  Options Indexes Multiviews

Alias /ms_tmp/ "c:/tmp/ms_tmp/"

The second alias line configures the location of temporary files created by PHP/Mapscript. You will have to adjust the RAPC sources to use the same alias and path. Adjust the path names according to your RAPC installation path.

4.2.5. PHP

The PHP scripting language is available from www.php.net.

RAPC is currently using PHP 4.*. Use of RAPC with PHP 5.0 will require some small changes to the application and is not recommended yet. Please contact the RAPC developers if PHP 5.0 is a requirement for your installation.

Follow the installation instructions in the PHP documentations.


If you don't install PHP to c:\windows\php, some of the settings below have to be adjusted.


Because of previous PHP/Mapscript limitations, it is recommended to install PHP as a CGI command.

The use of PHP as an Apache module is not very well tested with RAPC and may lead to instabilities. If you are testing such a setup, please share your experiences with the RAPC developers.

The installation can be completed with the following three lines in httpd.conf:

ScriptAlias /php/ "c:/windows/php/"
AddType application/x-httpd-php .php
Action application/x-httpd-php "/php/php.exe"

Again, make sure that the path names above match the ones on your system.

Add the following RAPC-specific configuration settings to c:\windows\php.ini:

default_mimetype = "text/html"
default_charset = "utf-8"

include_path = ".;c:\windows\php\pear"

error_reporting  =  E_ALL & ~E_NOTICE

extension_dir = "c:/windows/php/extensions"
enable_dl = On

allow_call_time_pass_reference = On

file_uploads = On
upload_tmp_dir = c:\tmp
upload_max_filesize = 20M


session.save_path = c:/tmp


In order to use gettext in PHP on Linux, the PHP safe mode has to be enabled. The reason is that the putenv() function to set the locale will fail otherwise. In php.ini:

safe_mode = On

4.2.6. Mapserver

On Windows, install the mapserver distribution with PHP/Mapscript, which is available from the internet under http://maptools.org.

On other operating systems, install PHP/Mapscript from the Mapserver distribution which is available from http://mapserver.gis.umn.edu/index.html.

Make sure that the PHP/Mapscript extension is loaded in php.ini.


You'll need a PHP/Mapscript binary compiled with PostGIS support.

4.3. Default Accounts

Upon first installation, the RAPC application will provide two default PostgreSQL (RAPC) users:

  • User rapc with password rapc.

  • User admin with password admin.

As the name indicates, admin has administrator rights, whereas the user rapc has not.

See Section 3.3, “PostgreSQL users” for detailed information on Windows and PostgreSQL users.


On production systems, you should change the default passwords as soon as possible for security reasons.

4.4. Checklist

The following points should be checked before a RAPC goes into production:

  • System clock setting

  • User rights

  • Security updates

  • Network connections

  • Eventually all removable media drives should be disabled to prevent installation of software

  • The PostgreSQL timezone setting. If necessary, adjust postgresql.conf, e.g. by adding a line like

    timezone = 'GMT-3'

    You can check the timezone setting by the following SQL statement:

    select now()

    Failure to configure the timezone correctly will result in the following error message in the logon page: Configuration Error: PHP Time != PostgreSQL time.

4.5. Optional Tools

This section describes the installation of various optional tools that ease the RAPC administration and configuration.

4.5.1. Active Perl

Active Perl is a PERL distribution for Windows.

It is freely available from http://www.activestate.com.

PERL is the programming language used for some PostGIS maintenance tools like postgis_restore.pl.

On other operating systems like Linux, you will most likely be able to use the PERL distribution that is already installed.

4.5.2. GIX

GIX is an ArcView 3.* extension that allows to export views to mapserver map files.

GIX is available from http://gix.sourceforge.net.


You can only use fragments from the map files created by GIX as ArcView 3.* does not support PostGIS.

See Section 5.2, “Custom Map” for details regarding the RAPC map files.

4.5.3. poEdit

To edit the rapc.po files, poEdit is recommended. It is freely available from http://poedit.sourceforge.net.


Install poEdit version 1.3.1 or higher.

In order to extract the translation messages from the PHP sources, the following settings should be applied.

Start poEdit.

Select Preferences from the File menu.

Select the Parser tab and click on the New button.

poEdit PHP parser settings

Figure 42. poEdit PHP parser settings

Fill in the settings as shown in Figure 42, “poEdit PHP parser settings”

Close the dialogs.

Open a rapc.po file.

Choose Options... from the Catalog menu.

In the Paths tab, add the path to the RAPC source as shown in Figure 43, “Catalog Path”

Catalog Path

Figure 43. Catalog Path


Make sure that you enter the actual path to the RAPC sources on your system.

Once the settings above have been applied, it is possible to update the catalog by selecting Update from sources from the Catalog menu.

See also Section 3.4, “Translation System”.

5. Configuration

This section describes how to configure RAPC after successfull installation.

5.1. Configuration Files

The file conf/rapcconfig.php contains the configuration of the RAPC application.

A default configuration file is stored under conf/rapcconfig.php.default. Copy this file to conf/rapcconfig.php if necessary.

The configuration file can be edited using any text editor.

All other configuration files can be found in the conf folder: c:\Program Files\rapc\conf.

5.2. Custom Map

How to use your own maps with RAPC.

Create your own map file(s) and edit the following line in dcmconfig.php to point to this file:

$_SESSION["strMapFile"] = "conf/rpac_%s.map";


When customizing the map files, make sure to use other names than rapc_en.map. An update of the application would otherwise overwrite your customized map files.

Adjust rapcconfig.php accordingly.

In the default configuration, you need one map file for every language (%s will be replaced with the two-letter ISO language code).

If you would like to use RAPC in more than one language.


The "DESCRIPTION" metadata information must be provided for layers that return results for the identify tool.

In addition, the "TEMPLATE" has to be set for the respective class.

The following layers are required and should be copied from the sample files:


The default map resolution in map.php can be configured in the map file. Look for a line like the following:

SIZE 600 450

Currently the following configurations are possible without changes to the PHP source:
SIZE 400 300
SIZE 600 450
SIZE 800 600


RAPC comes with symbol and font definitions in the files etc\symbols.sym and etc\fonts.txt. It is recommended that you use different files for custom symbol and font definitions.

A RAPC update will overwrite these files.


Use shptree.exe from the mapserver distribution to index large shape files used by the application.

Indexes created by shptree.exe will increase the performance when PHP/Mapscript is dealing with these files.

Note that the shptree.exe index format differs e.g. from the one used by ArcView.

The mapserver documentation available from http://mapserver.gis.umn.edu/ contains detailed information about the mapfile syntax.

5.2.1. PostGIS Layers

The RAPC application replaces the dummy user name and password in the mapfile with the information provided by the user when logging on. Example 1, “PostGIS Connection Example” shows an example PostGIS connection line from a mapfile.

Example 1. PostGIS Connection Example

CONNECTION "dbname=rapc user=dummy password=dummy host=localhost"


Make sure that the PostgreSQL "rapcuser" group has the right to select from the tables used for your PostGIS layers.

5.3. Plug-Ins

5.3.1. Identify Plug-Ins

Plug-ins for the identify tool of the map page allow to extend the functionality of the application.

The plug-ins are configured in conf/identifyplugin.ini. The file is a simple text file that can be edited with any text editor.

; Configuration file for map.php plug-ins
Plugin1 = ImageIdentifyPlugin
Layer1 = Panel
;Plugin2 = ???
;Layer2 = ???
  • Lines starting with ";" are comments and are ignored.

  • Section header of the IdentifyPlugin section.

  • The class ImageIdentifyPlugin (from plugin/imageidentifyplugin.php) will be loaded as the first plug-in. The configuration line for the second plug-in starts with "Plugin2"

  • The first plug-in will be used when the identify tool selects features in the "village" layer.

  • The configuration lines for the second plug-in are commented out, this plug-in has been disabled.

Note that identifyplugin.ini can also contain configuration options for the individual plug-ins (in different sections). See the "[Plugin1]", "[Plugin2]", ... sections for details.

6. Administration

This section describes various tasks related to the RAPC administration.

6.1. GIS Data Loading

This section discusses various ways to load GIS data in various formats to the rapc database.


Not all GIS data used by the application has to be loaded to the database. Data that is only displayed on the map and not used otherwise in the application can be kept in its original format and location if it is supported by Mapserver. This is the case for shapefiles. Unless you are restoring a backup.

Besides the options described in the following sections, tools like ogr, QGIS or FME can also be used to load the data.

If you would like to load and use data in multiple languages.

6.1.1. Shapefile Loader

The RAPC application allows to load GIS data in shapefile format through a web interface. Log in using a RAPC account with administrator rights, e.g. admin. Zip the shapefile before uploading.

See the RAPC User Guide for details on the shapefile loader.


Data that is edited in RAPC uses sequences to determine the next primary key. For this reason it might be necessary to adjust a sequence if certain shapefiles are loaded.

6.1.2. shp2pgsql

The commandline tool shp2pgsql is part of the PostGIS distribution and used internally by the RAPC shapefile loader web interface. It allows to load shapefiles to PostGIS tables.

Make sure that shp2pgsql.exe and psql.exe are in the path:

PATH=%PATH%;c:\Program Files\PostgreSQL\8.0\bin

If necessary, adjust the encoding used by psql through the PGCLIENTENCODING environment variable:


If the table does not exist in your database yet, omit the "-d" option when calling shp2pgsql. See the shp2pgsql documentation for details.

Recreate the views if necessary:

6.2. Recurring Tasks

6.2.1. Backup


You can use pgAdmin III as well as the commandline tools pg_dump or pg_dumpall to backup your RAPC database. Please refer to the pgAdmin III and PostgreSQL documentation for detailed information on how to perform the backups. In addition, the instructions below explain how to backup the database using the PostgreSQL command line tool pg_dumpall.

For all GIS data displayed in the RAPC maps, follow your usual backup strategies.

In order to backup the content of the RAPC database, do the following:

  1. Open a Windows commandline (e.g. by executing %SYSTEMROOT%\system32\cmd.exe).

  2. Execute the command below to create a dump file of the database. The dump file will be saved as c:\rapc-backup.sql.

    pg_dumpall -c -U postgres -h localhost > c:\rapc-backup.sql


    You have to make sure that pg_dumpall is in your PATH.

  3. Write the dump file to a suitable backup media (e.g. a rewritable CD-ROM or a tape) and store it in a safe place.


Make sure that you also backup your map and configuration and symbol files (c:\Program Files\rapc\include\dcmconfig.php and all files under c:\Program Files\rapc\conf).

6.2.2. Restore


Restore is available through pgAdmin III as well as the commandline tools psql or pg_restore. Please refer to the pgAdmin III and PostgreSQL documentation for details how to restore a database dump. In addition, the instructions below explain how to restore the database using the PostgreSQL command line tool psql.

Restore all the GIS data used in the map from your GIS data backups.

In order to restore a previous dump file of the RAPC database, execute the following commands:

  1. Open a Windows commandline (e.g. by executing %SYSTEMROOT%\system32\cmd.exe).

  2. Restore the dump file:

    psql -f c:\rapc-backup.sql -U postgres -h localhost -d rapc
    Where c:\rapc-backup.sql is the path to the dump file - adjust this accordingly if your dump file is not c:\rapc-backup.sql. Alternatively, you can copy your dump file to c:\rapc-backup.sql

    You may be asked to enter the password of the PostgreSQL superuser "postgres".

6.2.3. Removing Temporary Files

Remove old files from c:\tmp and c:\tmp\ms_tmp.


Be careful not to delete the c:\tmp\ms_tmp folder itself. If you delete the folder by accident, recreate it immediately.

The RAPC installer schedules a task that runs the script c:\program files\rapc\script\recreate_tmp.bat every day at 12:01.

The Schedule can be changed or deleted through the Windows Task Scheduler:

  • Select Start Menu->Control Panel.

  • Choose Performance and Maintenance from the list.

  • Click on Scheduled Task. The task will most probably be called at1.

6.2.4. Quality Control

All data related to the RAPC business processes should be checked, at least with some samples.

The following list is a preliminary list of checks that should be performed:

  • The data entry quality should be checked by comparing the Panel application papers against the contents of the database.

  • The database information should be verified with the route maps that should link the Panels within the route.

6.3. Security


A damaged RAPC installation can be difficult to repair and may require a complete re-installation of the system. For this reason, a proper user privilege separation is of utmost importance.

The user operating the RAPC application on the server must not have any administrator rights assigned.

The PostgreSQL administrator and the postgres accounts should be guarded by good passwords (not "password", "1234567quot; or "") and these password should only be known to the administrators.


When changing the password of the Windows user "postgres", the administrator has to re-enter the postgres password in the properties of the PostgreSQL Database Server 8.0 service.

7. Troubleshooting

This section gives help to solve problems with the RAPC installation.

7.1. RAPC Info Mailing List

The RAPC mailing list may provide help to solve problems, either through the archives which are available by sending an email to .

7.2. PostgreSQL Database Server Service

If the application fails to connect to the database, check that the "PostgreSQL Database Server" service is up and running on the server. The Windows Services control panel can be reached for example by right-mouse clicking on the Apache Monitor symbol in the taskbar and selecting Open Services from the context menu.


If you're running a firewall, make sure that the firewall is not blocking the connection from PHP to PostgreSQL.

7.2.1. PostgreSQL Database Server Service Fails to Start


Try to reboot the machine. Alternatively, log on as administrator and restart the service. The most common startup problem is a leftover postmaster.pid file.

If the PostgreSQL Database Server service fails to start, the Windows event log might provide useful information.


If the PostgreSQL service fails to start make sure that there is no file named c:\program.

7.3. Map Display

If map labels are not displayed properly (e.g. garbage routename) and you're using tiled shapefiles, check that all your shapefiles have exactly the same table definition. Field name, type and order have to be exactly the same in all your shapefile tiles.

7.4. Restore

Suppose you have problems restoring a RAPC database and you are getting the following error message: psql:rapc-2004-01-19.sql.lib:34: ERROR: could not load library "/usr/lib/postgis.dll": dlopen: Win32 error 127

Edit your sql file and replace all occurrences of /usr/lib/postgis.dll with $libdir/postgis.dll.

If there are error messages like ERROR: function geometryfromtext(text, integer) does not exist., the text to geometry cast might be missing. It can be recreated with the following SQL command

create cast (text as geometry)
  with function geometry(text) as implicit;


The better way to fix this problem is to use the PostGIS postgis_restore.pl script.

7.5. File Upload Fails

If the file upload in the Restore or Shapefile Loader pages fails, the following php.ini settings may have to be adjusted:


7.6. Unable to Load Dynamic Library

When trying to open a page, the following message appears on the server: Unknown(): Unable to load dynamic 'C:/Program Files/PHP/extensions\php_gettext.dll' - The specified module could not be found.

The following points may help to solve the problem:

  • Make sure that you've installed the zip distribution of PHP and not the installer version

  • Copy the file OCI.dll from c:\oracle\bin to c:\oradev\bin.

    Copy the file libintl-1.dll from c:\program files\php\dlls to c:\winnt\system32 or c:\windows\system32.

    This also applies to iconv.dll - in this case, copy iconv.dll to c:\windows\system32 or c:\winnt\system32.

    The dll files can be found in the folder dlls of the PHP distribution

7.7. Log Files

Apache, PostgreSQL, PHP and some of the installers write log files that are often helpful when troubleshooting.

The level of verbosity of the server logs can often be specified in the server configuration files.

The following locations might contain important log files:

  • %TEMP% - log files of the rapc installer scripts

  • c:\program files\PostgreSQL\8.0\pg_log - fodler with log file of the PostgreSQL server.

  • The windows system log files.

7.8. Htdig

Make sure that the rapc application is not indexed by htdig. This will lead to an endless loop and slow down your system.

The htdig package offers as search engine for websites. Please check wether you're running htdig before investigating further.