CartoWeb 3.5.0
Download Now!


CartoWeb
Advanced Geographical Information System for the Web

Prerequisites for Creating a New Project

  • A valid MapServer mapfile

If you don't have one, create one. See MapServer mapfile specifications there: http://mapserver.gis.umn.edu/docs/reference/mapfile

This is also valid for how to use shapefiles as source of data.

Project Template

The easiest way to create a project is to use an existing one as template. We would suggest to use the demoCW3 project, as it is the closest to a complete usable project.

Simply duplicate the demoCW3 project folder and rename it to your project name.

Renaming Files

If you used the demoCW3 project as template, several files must be renamed:

In the server_conf folder, rename the file demoPlugins.ini.in to your_project_name.ini.in.

Rename the folder server_conf/demoCW3 into server_conf/your_project_name (this folder must have the same name as your main project folder name).

Mapfile

Put your mapfile into server_conf/your_project_name/ and give it a recognisable name (usually your project name).

In this example it would be your_project_name.map.

Configuration

''server_conf/layers.ini''

Now create a layers.ini file. This file will contain the hierarchy of layers that will be displayed in the interface.

See HowToCreateALayerTree for more details on how to create a layers.ini file.

''client_conf/client.ini.in''

The client.ini.in file contains some variable parameters that will be replaced when you launch the cw3setup.php installation script. A client.ini file is then created.

If you open the client.ini.in, you will notice theses lines at the top:

;@BLURB@

cartoclientBaseUrl =  "@CARTOCLIENT_BASE_URL@"
profile = @PROFILE@

;@BLURB@ indicate that some parameters are set automatically with the install script.

All parameters enclosed by @ will be replaced. In this case cartoclientBaseUrl and profile.

cartoclientBaseUrl will take the value of the --base-url parameter of the install script. (For reference, it is the URL to the cartoclient htdocs folder as it appears in your browser. Ex: on Windows systems it could look like http://localhost/cartoweb3/htdocs/ , on UNIX-like systems it could look like /var/www/cartoweb3/htdocs/ . This obviously depends on where you decided to install CartoWeb).

For more info about cartoclientBaseUrl, see http://www.cartoweb.org/doc_head/docbook/xhtml/user.config.html

profile will take the default value specified in cartoweb3/client_conf/client.ini.dist , it is set to development. It was previously set to production, but this was changed to make project development easier.

For more info about profile, see http://www.cartoweb.org/doc_head/docbook/xhtml/user.config.html#user.config.common

In your client.ini.in, define the mapfile to use:

mapId = the_name_of_your_mapfile_name_without_the_.map

In this example it would be your_project_name.

Remove checkInstall from the list of plugins in :

loadPlugins = exportCsv, exportPdf, outline, auth, checkInstall

Then delete the checkInstall folder in your project's plugin folder. (This is a special plugin of the demoCW3 project, checking if the specific data files are present or not)

''server_conf/your_project_name.ini''

This file contains the initial state of your project, such as the extent coordinates of the visible area, the selected layers by default and such.

See http://www.cartoweb.org/doc_head/docbook/xhtml/user.config.html#user.config.server.maps_config.initial for more info about initialMapStates.

Correct or comment the lines as needed, as the location.bbox (extent) is probably wrong for your project, same for the layers names (the layers names are the same as used in the layers.ini file).

''client_conf/location.ini.in''

Remove or comment the line with idRecenterLayers = ..., as this will cause an Error [8, Undefined offset: 0, ... error, as the layers references are for the demo data only. You can use the recenter functionnality, but use valid layers for your mapfile.

If you do not use a database for the search functionality, you can remove the dsn = ... line, and rename the file from location.ini.in to location.ini.

That's it.

Setup Your Project

In a command line prompt (DOS, shell) launch the cw3setup.php setup script

<PHP-INTERPRETER> cw3setup.php --install --base-url http://localhost/cartoweb3/htdocs/

See http://www.cartoweb.org/doc_head/docbook/xhtml/user.install.html#user.install.main.setup for more info on the installation script.

If no error occured, you should be able to access your project by typing http://localhost/cartoweb3/htdocs/ in your browser and selecting your project from the projects drop-down menu.

Tips&Trick

Project shortcut

To make development easier, you can create a shortcut file to access your project directly. Go in cartoweb3/htdocs/ and copy the file demoCW3.php.

Rename the file to any name (usually your project name). Edit the file and replace 'demoCW3' by 'your_project_name'. Your project is now directly available with the URL http://localhost/cartoweb3/htdocs/your_project_name.php . (the URL given above depends on your installation, see the previous comments about cartoclientBaseUrl and --base-url).

Simplify project update (no long base-url)

If you do not need special parameters during installation for your project, you can simply use a client.ini file instead of a client.ini.in . Simply delete the client.ini.in if it exist and set the parameters as you want in the client.ini file. This way you can call the install script cw3setup.php with any value in the --base-url parameter (like foo or whatever you want, which takes quite less time than typing again a full long url)

If you need to keep a .ini.in file but dont want to bother with the --base-url, remove the corresponding @parameters@ .

CartoWeb Wiki: HowToCreateANewProjectOld (last edited 2007-08-15 10:51:06 by OliverChristen)

© 2002-2007 CartoWeb by Camptocamp SA - Wiki powered by MoinMoin