Principle
The basic idea is that GPT is capable of rendering maps from specially prepared SVG images. You just have to use specific classes for various objects and GPT will assign specific colors to them.
When configured in GPT, a SVG map will be the subject of two transformations:
- all objects of class
constituency_n, n being the number of a constituency, will have their color (style SVG attribute) replaced by a tone representing how many signatories there are in the constituency - all objects of class
count_n, n being the number of a constituency, will have their XML content replaced by a number, being how many signatories there are in the constituency
Pre-requisites
There is only one pre-requisite : inkscape version 0.44 or higher. It must be installed before you configure GPT for the first time or you will have to edit the INKSCAPE_PATH variable in the GPT configuration file (i.e. set it to /usr/bin/inkscape if it is installed there).
If Inkscape is not installed, maps will not be rendered but you will be able to download them in SVG format nevertheless.
Preparing the map
It is as simple as using a vector drawing tool. Just open a map of your country or region in your favouring vector drawing tool (assuming it can open/save SVG files). All following examples will demonstrate the use of the Inkscape drawing tool. For instance, you can open the attached example that demonstrates how to tag the map.
Obtaining the constituencies numbers
To obtain the numbers of constituencies, just log in to GPT and go to the administrative interface (see the GPT Administration Guide). Then, click on Manage constituencies and you will see the numbers affected to each constituency (do NOT confound with the ID, which is internal and not used there). Moreover, you can change them by clicking on a constituency and changing the number in its entry.
Tagging constituencies for future color treatment
Here is how we would tag the various French regions in order to produce a map of the European 2009 parliament election : open your SVG map in Inkscape and click on a region or department to select it. Then, click on the XML editor option in the toolbar (see screenshot).
Then, a dialog will popup that will allow you to set the SVG class of selected object. Now, if this object represents, say, constituency number 123, just set its class to constituency_123, like in the following screenshot.
That is all, be sure to do the same for ALL constituencies. Several objects can share the same class, thus if you have a composed map (like, showing a bunch of islands), all pertaining objects will be treated the same.
Note: it is also possible to set the ID of the SVG object to constituency_n, but the SVG schema only authorize unique IDs, so several objects cannot share the same ID.
Tagging labels to display a total
The same approach is used to produce labels that will dynamically show the number of signatories per constituency. Just select a text object and set its class to count_n, n being the number of the constituency. For instance, for constituency 2, just put count_2.
Setting the title and meta data
GPT also uses three more data from the map:
the title. It is located in the
<dc:title>XML entity and is referred as Title in the Document Metadata.the language of the map. It is located in the
<dc:language>XML entity and is referred as Language in the Document Metadata. The language should be left empty if map is not specific to a language. If language is set, it should be the ISO two letters code of the country, like "fr" for France.the election this map is related to. It is located in the
<rdf:li>XML entity and is referred as a Keyword in the Document Metadata. Please note that as there is no standard "election" meta data in SVG, We used the Keyword meta data to handle this.
To set these various meta data, just click on File / Document Metadata and the following panel will popup, asking you to setup meta data. Only the three mentioned meta data will be used, but you can tag other data at your idea.

Putting it all together
For now, you should have a nicely prepared map, ready to upload to your GPT installation. Just upload it to your website in the templates/maps subdirectory. Note that this map should have the .svg extension.
Then, point your browser to your GPT installation, log in and click on the "Maps" link of the controls links. If everything went fine, you should have a list of installed maps, each of them displaying their title.
Click on the link and you will have a shiny new map with a link to various formats.
Troubleshooting
I don't see my map in the list
Be sure :
that you have uploaded it in the correct subdirectory (
templates/maps)that the webserver has permission enough to read it
that language and elections are either empty or set to the current election
When I click on a map, I see no map, just a link to the SVG version
You probably have no Inkscape installed on your webserver, install it and configure the INKSCAPE_PATH variable correctly in the include/options.php file.
I have an obsolete version of the map, that never refreshes
As rendering the map is costly, GPT caches the map in the templates/compiled subdirectory. If for any reason something changed the permission of the "compiled" file, GPT cannot produce a new one. So remove the faulty version, it has the same name as the map and there are three possible version, the SVG, PNG and PDF versions.
There is an error in the maps, I get PHP errors instead of a SVG map
There is an issue in GPT or in the server. Check that there is space enough in your webserver. If that does not solve the issue, contact us.
