|Version 9 (modified by elemoine, 6 years ago)|
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 To Use Map Fish Server?.
Go to How To Install and install MapFish and MapFish Server Framework.
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.
The MapFishSample project relies on geographic data in PostGIS.
The data is available as database dumps in http://dev.mapfish.org/data. Download the geostat.dump.gz and c2corg.dump.gz dump files and extract them. Then, create the user www-data, and import the dumps into PostGIS using the special postgis_restore.pl script.
To create user www-data login as postgres (admin) and do:
createuser -SDRP www-data
You can then restore the databases:
wget http://svn.refractions.net/postgis/trunk/utils/postgis_restore.pl chmod +x postgis_restore.pl wget http://dev.mapfish.org/data/v0.2/geostat/geostat.dump.gz gunzip geostat.dump.gz ./postgis_restore.pl /usr/share/postgresql-8.1-postgis/lwpostgis.sql geostat geostat.dump -E UTF8 wget http://dev.mapfish.org/data/v0.2/search/c2corg.dump.gz gunzip c2corg.dump.gz ./postgis_restore.pl /usr/share/postgresql-8.1-postgis/lwpostgis.sql c2corg c2corg.dump -E UTF8
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 values of sqlalchemy.search.url and sqlalchemy.geostat.url. For example:
sqlalchemy.search.url = postgres://www-data:password@localhost/c2corg sqlalchemy.geostat.url = postgres://www-data:password@localhost/geostat
- password is the password of the www-data user
- localhost the database host name
- c2corg the name of the database into which c2corg.dump was imported
- geostat the name of the database into which goetstat.dump was imported
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
Later, if you want to update MapFish and MapFishSample, just do: