DCMMS Administration Guide

Maher Abdel Karim

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is available from the Free Software Foundation (http://www.gnu.org).

2006


Table of Contents

General
1. Introduction
1.1. Typographic Conventions
1.2. UML
1.3. Deployment
2. Overview
3. Requirements
3.1. Hardware
3.2. Software
3.2.1. Operating System
3.2.2. PostGIS
3.3. Folder Structure
3.4. Administrator
4. Concepts
4.1. Services
4.2. Windows Users
4.3. PostgreSQL users
4.4. Translation System
4.4.1. Gettext
4.4.2. The dcmmstranslation() Function
4.4.3. Map File Localization
4.5. Mailing Lists
Reference
1. Installation
1.1. Windows Installation
1.1.1. Apache
1.1.2. PHP
1.1.3. PostgreSQL
1.1.4. PostGIS
1.1.5. DCMMS
1.1.6. Sample data
1.2. Manual Installation
1.2.1. PostgreSQL
1.2.2. PostGIS
1.2.3. PostArabic
1.2.4. Fuzzystrmatch
1.2.5. Apache
1.2.6. PHP
1.2.7. Mapserver
1.2.8. DCMMS
1.2.9. Sample data
1.3. Default Accounts
1.4. Checklist
1.5. Optional Tools
1.5.1. Active Perl
1.5.2. GIX
1.5.3. poEdit
1.5.4. R
2. Configuration
2.1. Configuration Files
2.2. Custom Map
2.2.1. Tiled Shapefiles
2.2.2. PostGIS Layers
2.3. Plug-Ins
2.3.1. Identify Plug-Ins
3. Administration
3.1. GIS Data Loading
3.1.1. Shapefile Loader
3.1.2. shp2pgsql
3.1.3. AdministrativeArea, Village and Landmark
3.2. Unit Cost Data Loading
3.3. Recurring Tasks
3.3.1. Backup
3.3.2. Restore
3.3.3. Merge DCMMS Databases
3.3.4. Removing Temporary Files
3.3.5. Quality Control
3.4. Security
4. Analysis
4.1. Repairs per PressurizedMain
4.2. Pressure Dependency
5. Procedures
5.1. GIS Data Review
6. Updating
6.1. From 1.1.1 to 1.1.2
6.2. From 1.1.0 to 1.1.1
6.3. From 1.0.5 to 1.1.0
6.4. From 1.0.4 to 1.0.5
6.5. From 1.0.3 to 1.0.4
6.6. From 1.0.1 to 1.0.3
6.7. From 1.0.1 to 1.0.2
6.8. From 1.0.0 to 1.0.1
7. Frequently Asked Questions
7.1. There are too many coded values. How can I remove them?
8. Troubleshooting
8.1. DCMMS Info Mailing List
8.2. Support Tracker
8.3. Complete Uninstallation
8.4. Shapefile Loader problems
8.5. Configuration error: PHP time != PostgreSQL time
8.6. Permission Denied for Relation CauseDomain
8.7. ERROR: column "oid" does not exist
8.8. New Landmarks Disappear
8.9. PostgreSQL Update
8.10. PostgreSQL Database Server Service
8.10.1. PostgreSQL Database Server Service Fails to Start
8.11. FATAL ERROR: PHP extension 'MapScript' is not loaded
8.12. Map Display
8.13. Restore
8.14. File Upload Fails
8.15. Unable to Load Dynamic Library
8.16. Log Files
8.17. MapLab
8.18. Htdig
Index

List of Figures

1. UML Legend
2. Stand-Alone Deployment
3. Client-Server Deployment
4. Internet Deployment
5. Component Diagram
6. Control Panel
7. Services Panel
8. Windows Users
9. PostgreSQL Users
10. Apache Wizard
11. Apache License
12. Apache Readme
13. Apache Information
14. Apache Setup Type
15. Apache Location
16. Apache Install
17. PHP License
18. PHP Components
19. PHP Location
20. PostgreSQL Language Selection
21. PostgreSQL Setup
22. Installation Notes
23. Choose Installation Options
24. Service Configuration
25. Account Error
26. Password
27. Successfully granted the 'Logon as a service' right
28. Initialise Database Cluster
29. Enable Procedural Languages
30. Enable Contrib Modules
31. Enable PostGIS
32. Ready to Install
33. Installation complete
34. PostGIS License
35. PostGIS Components
36. PostGIS Location
37. PostGIS Database Connection
38. Installation Complete
39. DCMMS License
40. DCMMS Components
41. DCMMS Location
42. DCMMS Database Connection
43. poEdit PHP parser settings
44. Catalog Path
45. NGWA GIS Data Review

List of Examples

1. PostGIS Connection Example
2. PostgreSQL 8.0 Backup
3. PostgreSQL 8.1 Restore
4. Old AreaOfInterest Class
5. New AreaOfInterest Class
6. PostGIS 1.0.3 Update
7. Run update_dcmms_ddl.sql

General


1. Introduction

This document describes how to setup and administer the DC Maintenance Management System (DCMMS) application version 1.1.2 .

In addition Section 4, “Analysis” covers some data analysis options.

DCMMS is available from http://dcmms.sourceforge.net.

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

Feedback on DCMMS is welcome and can be addressed to .

DCMMS Developer Guide and DCMMS User Guide provide additional information about the application.

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 DCMMS 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 DCMMS 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

[Caution]Caution

The DCMMS 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 DCMMS 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. Overview

Figure 5, “Component Diagram” gives overview of DCMMS and its components. Depending on the GIS data sources to be used, other components might be required or optional components could be removed.

The database components can run on other servers.

Component Diagram

Figure 5. Component Diagram

3. Requirements

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

3.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 workorders, a printer with at least 300dpi resolution is required.

[Tip]Tip

Call-center grade headphones are strongly recommended in order to receive customer complaint calls.

3.2. Software

The following software packages are required to run the DCMMS 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 1, “Installation”covers the installation of all required software packages.

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

3.2.1. Operating System

[Caution]Caution

While it might be possible to install the DCMMS 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 DCMMS on other operating systems such as Linux may require minor changes to the source code. Please contact the DCMMS developers if you are having problems. The initial DCMMS version was created on Linux.

3.2.2. PostGIS

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

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

3.3. Folder Structure

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

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

[Note]Note

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.

[Tip]Tip

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\dcmms\config contains all configuration files with the exception of c:\Program Files\dcmms\includedcmconfig.php.

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

c:\Program Files\dcmms\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\dcmms\plugin contains application plug-ins (extensions that extend the functionality).

3.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.

4. Concepts

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

4.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 6, “Control Panel”.

Control Panel

Figure 6. 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 7, “Services Panel”.

Services Panel

Figure 7. Services Panel

The Status column shows the services that are currently running. In Figure 7, “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.

4.2. Windows Users

Important information on Windows user accounts.

Windows Users

Figure 8. Windows Users

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

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

[Note]Note

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

[Note]Note

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

4.3. PostgreSQL users

Introduction to PostgreSQL user management.

PostgreSQL Users

Figure 9. PostgreSQL Users

Figure 9, “PostgreSQL Users” shows PostgreSQL users that are important for the DCMMS 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.

[Caution]Caution

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 1.1.3, “PostgreSQL”).

4.4. Translation System

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

DCMMS is actually using two translation systems: GNU gettext for text that occurs in the PHP sources and the dcmmstranslation() for text stored inside the PostgreSQL database.

[Note]Note

The dcmmstranslation() is not yet used for all text stored inside the PostgreSQL database (especially coded values). This will change gradually in the future. For the time being administrators and developers have to understand both translation systems.

Both gettext and dcmmstranslation() 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).

4.4.1. Gettext

GNU gettext is a widely used system for translation management.

DCMMS is using the PHP gettext extension, the translations are edited in the locale/*/LC_MESSAGES/dcmms.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 (dcmms.po) files have to be compiled to dcmms.mo files.

Editing and compilation is conveniently done with poEdit (Section 1.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.

4.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 3.1.1, “Shapefile Loader”) allows to update the translation table from fields like enname (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().

4.4.3. Map File Localization

DCMMS allows to use language-specific map files.

The application replaces "%s" with the two-letter ISO language in the following dcmconfig.php configuration option:

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

This way it is possible to encapsulate language specific information in the map files.

PostGIS layers used in the map files can use the dcmmstranslation() function for translation.

See also Section 2.2, “Custom Map”

4.5. Mailing Lists

Mailing lists are automated distribution systems for emails.

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.

[Tip]Tip

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

Reference


Table of Contents

1. Installation
1.1. Windows Installation
1.1.1. Apache
1.1.2. PHP
1.1.3. PostgreSQL
1.1.4. PostGIS
1.1.5. DCMMS
1.1.6. Sample data
1.2. Manual Installation
1.2.1. PostgreSQL
1.2.2. PostGIS
1.2.3. PostArabic
1.2.4. Fuzzystrmatch
1.2.5. Apache
1.2.6. PHP
1.2.7. Mapserver
1.2.8. DCMMS
1.2.9. Sample data
1.3. Default Accounts
1.4. Checklist
1.5. Optional Tools
1.5.1. Active Perl
1.5.2. GIX
1.5.3. poEdit
1.5.4. R
2. Configuration
2.1. Configuration Files
2.2. Custom Map
2.2.1. Tiled Shapefiles
2.2.2. PostGIS Layers
2.3. Plug-Ins
2.3.1. Identify Plug-Ins
3. Administration
3.1. GIS Data Loading
3.1.1. Shapefile Loader
3.1.2. shp2pgsql
3.1.3. AdministrativeArea, Village and Landmark
3.2. Unit Cost Data Loading
3.3. Recurring Tasks
3.3.1. Backup
3.3.2. Restore
3.3.3. Merge DCMMS Databases
3.3.4. Removing Temporary Files
3.3.5. Quality Control
3.4. Security
4. Analysis
4.1. Repairs per PressurizedMain
4.2. Pressure Dependency
5. Procedures
5.1. GIS Data Review
6. Updating
6.1. From 1.1.1 to 1.1.2
6.2. From 1.1.0 to 1.1.1
6.3. From 1.0.5 to 1.1.0
6.4. From 1.0.4 to 1.0.5
6.5. From 1.0.3 to 1.0.4
6.6. From 1.0.1 to 1.0.3
6.7. From 1.0.1 to 1.0.2
6.8. From 1.0.0 to 1.0.1
7. Frequently Asked Questions
7.1. There are too many coded values. How can I remove them?
8. Troubleshooting
8.1. DCMMS Info Mailing List
8.2. Support Tracker
8.3. Complete Uninstallation
8.4. Shapefile Loader problems
8.5. Configuration error: PHP time != PostgreSQL time
8.6. Permission Denied for Relation CauseDomain
8.7. ERROR: column "oid" does not exist
8.8. New Landmarks Disappear
8.9. PostgreSQL Update
8.10. PostgreSQL Database Server Service
8.10.1. PostgreSQL Database Server Service Fails to Start
8.11. FATAL ERROR: PHP extension 'MapScript' is not loaded
8.12. Map Display
8.13. Restore
8.14. File Upload Fails
8.15. Unable to Load Dynamic Library
8.16. Log Files
8.17. MapLab
8.18. Htdig

1. Installation

This section outlines several installation options for the DCMMS application.

If you are updating an existing installation please refer to Section 6, “Updating”.

[Tip]Tip

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

[Tip]Tip

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

1.1. Windows Installation

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

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

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

1.1.1. Apache

[Tip]Tip

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.

[Tip]Tip

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 DCMMS CD or from the Apache website: http://httpd.apache.org.

Apache Wizard

Figure 10. Apache Wizard

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

Apache License

Figure 11. Apache License

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

Apache Readme

Figure 12. Apache Readme

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

Apache Information

Figure 13. Apache Information

Fill in the fields Network Domain (The domain of your Organization), Server Name (The name of your DCMMS 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 13, “Apache Information”).

Apache Setup Type

Figure 14. Apache Setup Type

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

Apache Location

Figure 15. Apache Location

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

[Tip]Tip

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

Apache Install

Figure 16. Apache Install

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

[Tip]Tip

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
tasklist
Look for the process id (PID) of the process occupying port 80 and find the application of the process id.

1.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 17. PHP License

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

PHP Components

Figure 18. PHP Components

Click Next >.

[Tip]Tip

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 19. PHP Location

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

1.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 DCMMS CD or from http://pgfoundry.org/projects/pginstaller/.

[Note]Note

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 20. PostgreSQL Language Selection

Click Start > to begin the Installation

PostgreSQL Setup

Figure 21. PostgreSQL Setup

Click Next >.

Installation Notes

Figure 22. Installation Notes

Press Next > after reading the installation instructions.

Choose Installation Options

Figure 23. Choose Installation Options

[Caution]Caution

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

[Tip]Tip

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 DCMMS 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 23, “Choose Installation Options” and click Next >.

Service Configuration

Figure 24. Service Configuration

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

Account Error

Figure 25. Account Error

Select Yes.

Password

Figure 26. Password

Accept the random password by clicking OK.

[Tip]Tip

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

Successfully granted the 'Logon as a service' right

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

Click on OK.

Initialise Database Cluster

Figure 28. Initialise Database Cluster

Accept the default settings as shown in Figure 28, “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 >.

[Caution]Caution

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

Enable Procedural Languages

Figure 29. Enable Procedural Languages

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

Enable Contrib Modules

Figure 30. Enable Contrib Modules

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

Enable PostGIS

Figure 31. Enable PostGIS

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

PostGIS will be enabled for the dcmms database by the DCMMS installer.

Ready to Install

Figure 32. Ready to Install

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

Installation complete

Figure 33. Installation complete

Click Finish.

[Tip]Tip

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

1.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 34. PostGIS License

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

PostGIS Components

Figure 35. PostGIS Components

[Caution]Caution

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

The dcmms database will be created by the DCMMS installer.

PostGIS Location

Figure 36. PostGIS Location

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

[Note]Note

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

PostGIS Database Connection

Figure 37. PostGIS Database Connection

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

Installation Complete

Figure 38. Installation Complete

Click Close

1.1.5. DCMMS

Start the DCMMS Setup, which is available from the setup folder of the DCMMS CD or from the internet: http://dcmms.sourceforge.net.

DCMMS License

Figure 39. DCMMS License

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

DCMMS Components

Figure 40. DCMMS Components

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

DCMMS Location

Figure 41. DCMMS Location

Accept the default installation path, c:\program files\dcmms, as shown in Figure 41, “DCMMS Location” and click Next >.

DCMMS Database Connection

Figure 42. DCMMS Database Connection

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

You should now be able to start the DCMMS 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.

[Note]Note

The installer will not overwrite existing DCMMS configuration files.

1.1.6. Sample data

The DCMMS sample installer is available in the setup folder of the CD or on the internet: http://dcmms.sourceforge.net.

Run the installer and accept the default parameters, especially the default installation path, c:\program files\dcmms.

1.2. Manual Installation

How to install DCMMS manually.

[Note]Note

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

[Tip]Tip

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

[Caution]Caution

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.

1.2.1. PostgreSQL

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

The PostgreSQL installation should support UNICODE.

[Warning]Warning

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 DCMMS logins with password authentication, the pg_hba.conf configuration file should be altered like in the following example:

# TYPE  DATABASE    USER      IP-ADDRESS  IP-MASK           METHOD
host    all         postgres  127.0.0.1   255.255.255.255   trust
host    dcmms       all       127.0.0.1   255.255.255.255   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 DCMMS.

[Note]Note

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 DCMMS configuration).

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

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

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

1.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 dcmms database:

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

1.2.3. PostArabic

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

[Tip]Tip

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.

The PostArabic sources are available from the DCMMS download page.

Follow the installation instructions in the file README.arabic.

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

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

1.2.4. Fuzzystrmatch

DCMMS allows the fuzzy search of landmarks. Through the fuzzy search, landmarks can be found even if the search term was misspelled.

The fuzzystrmatch module of the PostgreSQL distribution is used for this purpose.

To compile and install the fuzzystrmatch module, go to the contrib folder of your PostgreSQL source tree and execute the following commands:

make
make install
psql -U postgres -h localhost -f fuzzystrmatch.sql

If you are using the Windows PostgreSQL installer, you find fuzzystrmatch.dll in c:\Program Files\PostgreSQL\8.0\share\contrib.

1.2.5. 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 DCMMS application by a convenient URL like http://localhost/dcmms/, you should add lines like the following to httpd.conf:

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

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 DCMMS sources to use the same alias and path. Adjust the path names according to your DCMMS installation path.

1.2.6. PHP

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

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

Follow the installation instructions in the PHP documentations.

[Note]Note

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

[Caution]Caution

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 DCMMS and may lead to instabilities. If you are testing such a setup, please share your experiences with the DCMMS 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 DCMMS-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

extension=php_gd2.dll
extension=php_gettext.dll
extension=php_pgsql.dll
extension=php_zip.dll
extension=php_mapscript_46.dll

[Session]
session.save_path = c:/tmp
      

[Caution]Caution

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

1.2.7. 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.

[Note]Note

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

1.2.8. DCMMS

The DCMMS source tarball is available from http://dcmms.sourceforge.net.

The SQL scripts create_dcmms_ddl.sql and create_views.sql in the script folder of the DCMMS distribution create users and data model for the application.

Change the directory to the script folder and run the scripts on the dcmms database:

psql -U postgres -h localhost -f create_dcmms_ddl.sql dcmms
psql -U postgres -h localhost -f create_views.sql dcmms

Copy the default configuration file, include/dcmconfig.php.default to include/dcmconfig.php.

Review the settings in dcmconfig.php and adjust if necessary.

Copy the default DataObject configuration file conf/dataobject.ini.default to conf/dataobject.ini.

Review the settings in dataobject.ini and adjust if necessary - especially all settings that include a path.

Copy the default identify plugin configuration file conf/identifyplugin.ini.default to conf/identifyplugin.ini.

Review the settings in identifyplugin.ini and adjust if necessary - especially all settings that include a path.

You should now be able to log on to the DCMMS application, using a URL like http://localhost/dcmms.

1.2.9. Sample data

A sample data set is available from the DCMMS download page.

Unpack the files to the data folder of your DCMMS installation.

Load the AdministrativeArea, Village and Landmark shapefiles to the database. This can be done using the shapefile loader of the DCMMS application (Section 3.1, “GIS Data Loading”) or using the following commands from the commandline:

set PGCLIENTENCODING=WINDOWS-1256
psql -d dcmms -U postgres -h localhost -f administrativearea.sql
psql -d dcmms -U postgres -h localhost -f village.sql
psql -d dcmms -U postgres -h localhost -f landmark.sql
In this case, the commands have to be executed in the data folder.

1.3. Default Accounts

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

  • User dcmms with password dcmms.

  • User admin with password admin.

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

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

[Caution]Caution

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

1.4. Checklist

The following points should be checked before a DCMMS 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.

    See also Section 8.5, “Configuration error: PHP time != PostgreSQL time”.

1.5. Optional Tools

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

1.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.

1.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.

[Note]Note

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

See Section 2.2, “Custom Map” for details regarding the DCMMS map files.

1.5.3. poEdit

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

[Tip]Tip

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 43. poEdit PHP parser settings

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

Close the dialogs.

Open a dcmms.po file.

Choose Options... from the Catalog menu.

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

Catalog Path

Figure 44. Catalog Path

[Caution]Caution

Make sure that you enter the actual path to the DCMMS 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 4.4, “Translation System”.

1.5.4. R

The R statistical analysis package can be used for the analysis. R is available from http://www.r-project.org/.

R can be used e.g. to analyze the pressure dependency of maintenance events (Section 4.2, “Pressure Dependency”).

2. Configuration

This section describes how to configure DCMMS after successfull installation.

2.1. Configuration Files

The file include/dcmconfig.php contains the configuration of the DCMMS application.

A default configuration file is stored under include/dcmconfig.php.default. Copy this file to include/dcmconfig.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\dcmms\conf.

2.2. Custom Map

How to use your own maps with DCMMS.

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

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

[Warning]Warning

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

Adjust dcmconfig.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 DCMMS in more than one language, please also read Section 4.4, “Translation System”.

[Note]Note

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:

AdministrativeArea
AreaOfInterest
Landmark
PressurizedMain
Village
[Tip]Tip

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

[Tip]Tip

DCMMS 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 DCMMS update will overwrite these files.

[Tip]Tip

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.

2.2.1. Tiled Shapefiles

Tiled shapefiles allow mapserver to maximize performance for large shapefile datasets.

The ngwa.map map file provides an example of tiled shapefile usage.

Please refer to the mapserver documentation for details on tiled shapefiles.

[Tip]Tip

Use the tileindex.exe from the mapserver distribution to create tile indexes.

[Caution]Caution

Uniform shapefiles have to be used when they are tiled. They have to have exactly the same number of fields in the same order.

To re-order shapefile fields using ArcView 3.*, follow these steps:

  • Open a View.

  • Add the shapefile as a Theme to the View.

  • Open the attribute table.

  • Drag and drop the field headers until they are in the correct order.

  • Go back to the View.

  • Select Theme->Convert to Shapefile.

2.2.2. PostGIS Layers

The DCMMS 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=dcmms user=dummy password=dummy host=localhost"
	    

[Important]Important

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

2.3. Plug-Ins

2.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
[IdentifyPlugin]
Plugin1 = ImageIdentifyPlugin
Layer1 = village
;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.

3. Administration

This section describes various tasks related to the DCMMS administration.

3.1. GIS Data Loading

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

[Tip]Tip

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, only the following three layers of GIS data have to be loaded to the DCMMS database:

AdministrativeArea
Landmark
Village

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, an understanding of the translation system (Section 4.4, “Translation System”) is required.

3.1.1. Shapefile Loader

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

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

[Note]Note

Data that is edited in DCMMS uses sequences to determine the next primary key. For this reason it might be necessary to adjust a sequence if certain shapefiles are loaded. One example is the landmark table. The following SQL statement shows how to set the correct start value for the sequence after the landmark shapefile is loaded:

select setval('landmark_seq', max(gid) from landmark);
	    

3.1.2. shp2pgsql

The commandline tool shp2pgsql is part of the PostGIS distribution and used internally by the DCMMS 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:

set PGCLIENTENCODING=WINDOWS-1256

Before the AdministrativeArea, Landmark or Village shapefiles are loaded to the database, the DCMMS views have to be dropped:

psql -d dcmms -U postgres -f \
"c:\Program Files\dcmms\script\drop_views.sql"
        

Load the shapefile to the database:

shp2pgsql -d -D landmark.shp landmark > landmark.sql
psql -d dcmms -U postgres -f landmark.sql

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:

psql -d dcmms -U postgres -f \
"c:\Program Files\dcmms\script\create_views.sql"
        

3.1.3. AdministrativeArea, Village and Landmark

How to prepare AdministrativeArea, Village and Landmark layers to be loaded to the application.

The features of AdministrativeArea shall not overlap and cover the whole area where landmarks are possibly inserted. The features of Village shall not overlap and cover the whole area where landmarks are possibly inserted. It is recommened to create a rectangular covering area around both classes.

The application expects the administra field in Landmark shall be filled with the CodedValue from the AdministrativeArea that contains (intersects) the landmark.

3.2. Unit Cost Data Loading

In case you have the unit cost information saved in an Excel sheet, to load unit cost information to the PostgreSQL database do the following:

  1. Delete all the fields from the file except for the folowing fields:

    1. ID

    2. Diameter1

    3. Diameter2

    4. Price

    5. Unit ID (The Subtype in Material, Staff or Equipment)

    [Important]Important

    You should keep the same fields order and Delete the names of the field.

  2. Save the Excel sheet file as a "Text(Tab delimited)" file

  3. Execute the following SQL statements for the Material cost file:

    delete from materialcost;
    copy materialcost from 
    'D:\\sandbox\\water\\dcmms\\txt_cost_sheet.txt'
    with NULL as ''
    delimiter as '\t';
  4. Repeat the same statements for the tables staffcost, equipmentcost