sfMapFishPlugin - 1.0.0

MapFish Server

You are currently browsing
the website for symfony 1

Visit the Symfony2 website

« Back to the Plugins Home


Forgot your password?
Create an account



advanced search
Information Readme Releases Changelog Contribute
Show source


The sfMapFishPlugin packages useful tools to manage geographical data from a Postgres/PotGis database with symfony & Doctrine.

It's the PHP implementation of the MapFish framework available


  • Install the plugin

    $ symfony plugin:install sfMapFishPlugin
  • Clear the cache

    $ symfony cache:clear
  • Build (or rebuild the model)

    $ symfony doctrine:build-model

Generate a MapFish controller

The way to generate a module responding to the restful MapFish Protocol is quite simple:

  • Specify the geometric column and the projection for your Model, in lib/model/doctrine/YourModelClass.php

    public static $geometryColumn = array('the_geom' => 4326);
  • In lib/model/doctrine/YourModelTableClass.php, make the class it extends

    YourModelTable extends sfMapFishTable
  • You're now ready to generate the controller with a task:

    $ ./symfony mapfish:generate-module --generate-route frontend your_module YourModel

    The --generate-route will update the routing.yml file and add the corresponding sfMapFishRoute

sfMapFishPlugin gives two classes that extends Doctrine ones to deal with geographical stuff.

  • sfMapFishRecord: Extends Doctrine_Record with geographical specific stuff (will be automatically changed when models are built).
  • sfMapFishTable: Extends Doctrine_Record with geographical specific stuff (Due to Doctrine limitation Ticket #1976, you'll need to make this change from your own in the myModelTable.class.php : replace Doctrine_Table by sfMapFishTable)

Install print module

sfMapFishPlugin comes with a built-in controller for MapFish print protocol. (see MapFish PrintModuleDoc)

You'll to have java installed to make this working.

  • Enable this module in your app

        enabled_modules:  [default, mfPrint]
  • Copy the mandatory config file from the plugin to your config directory

    $ cp plugins/sfMapFishPlugin/data/print/print.yml config/print.yml
  • The print module should be ready & responding to mfPrint/info to get print configuration. Don't forget to configure the config.yml (see configuration. For example don't forget to allow your WMS services. The print.yml example given have 3 mandatory fields in the spec: title, comment, & mapTitle. You can get errors in your symfony log file (if enabled).

  • Troubles: You may have to change the java path to get it working:

    sfConfig::set('mf_jre_path', '/usr/bin/');


All classes have full API documentation.

You will also find some informations on the MapFish website:


  • sfMapFishGenerateModule: Generate a rest controller according to the specifications of the MapFish protocol

How to contribute.

If you want to contribute, follow these steps:

  • Check the prerequisites
    • The license must be BSD
    • You must follow symfony coding standards
    • The contribution must not be too specific
    • You must be sure you will be able to maintain your contribution
  • Create a ticket and attach a patch
    • Choose sfMapFishPlugin as the component
    • Change the qualification to Ready for core team


This plugin is realeased under a BSD license.