MapFishSample installation

MapFish SVN repository includes MapFishSample. MapFishSample is an example of MapFish project. This page describes how to install and set up that sample project. It assumes that the reader is familiar with PostGIS.

If you want to create your own MapFish project look at How ToUse Map Fish Server.

Prerequisite

Go to How ToInstall and install MapFish and MapFish Server Framework.

Download

Download MapFishSample either from the download page or from the SVN repository. If you download it from the download page you'll need to extract it somewhere. Below we assume that MapFishSample was extracted or checked out in the directory /path/to/mapfishsample/MapFishSample.

Data

The MapFishSample project relies on geographic data in PostGIS.

First thing is therefore to install PostgreSQL and the PostGIS extension.

The database schema and data are available in http://dev.mapfish.org/data/v1.0

  • download the .sql files and the helper bash scripts and place them in some directory
  • log in as postgres (PostgreSQL admin user)

The following steps apply to UNIX users. Windows users must adapt them as appropriate.

  • create a database user (e.g. "www-data"):
    createuser -SDRP www-data
    
  • edit create_database.bash and set the variables DBNAME, DBUSER, and PG_VERSION appropriately
  • execute the main bash script:
    /path/create_database.bash -p
    

Setup

Edit the Pylons configuration file (located in /path/to/mapfishsample/MapFishSample/development.ini).

First change the document_root variables to make it refer to the MapFish mfbase and examples directories (MapFish/client/mfbase and MapFish/client/examples).

Assuming you have installed MapFish in /path/to/mapfish/, development.ini would be:

...
[app:mfbase]
use = egg:Paste#static
# Set here the path to your MapFish directory:
document_root = /path/to/mapfish/MapFish/client/mfbase/
...
[app:examples]
use = egg:Paste#static
# Set here the path to your MapFish client/examples directory:
document_root = /path/to/mapfish/MapFish/client/examples/
...

Now change the database configuration by replacing the value of sqlalchemy.mapfishsample.url. For example:

sqlalchemy.mapfishsample.url = postgres://www-data:password@localhost/v1.0_mapfishsample

where:

  • password is the password of the www-data user
  • localhost the database host name
  • v1.0_mapfishsample the name of the database

Run

cd /path/to/mapfishsample/MapFishSample/
/path/to/somewhere/vpython/bin/paster serve development.ini 

After that, the Web application will be available at the http://localhost:5000/ URL.

Installation using the deployment mechanism (optional)

This describes how to install the MapFishSample using the deployment system. Warning: This uses the trunk version of MapFish

Refer to deployment for more information about the deployment scripts. This is only available on Unixish OSes or on Windows with Cygwin.

mkdir mapfishsample
cd mapfishsample
svn co -N http://www.mapfish.org/svn/mapfish/trunk/mapfishsample/deploy .
chmod +x deploy-mapfishsample.sh
./deploy-mapfishsample.sh -i

You can create a configuration file for your configuration. Look at the messages on the console:

...
Tried to import /path/to/mapfishsample/configs/your.hostname
...

This means you can create a file /path/to/mapfishsample/configs/your.hostname containing your own configuration parameters (look at source:trunk/mapfishsample/configs/defaults for an example).

You can now run the server with the command

./mapfishsample/run_standalone.sh

Later, if you want to update MapFish and MapFishSample, just do:

./deploy-mapfishsample.sh -u