Insight into KGeography

KGeography is a geography learning tool integrated with KDE-Edu. It helps a student to learn geography in a playful way. But it still doesn’t has all the maps as yet. How to add them? For adding a new map in KGeography, we need two things. One, the map (say in a file called mapname.png) and secondly, a kgm file (whose name should be mapname.kgm) to integrate the map with kgeography. Once we have them we can easily add them in its’ home directory (default: /usr/share/apps/kgeography). Now, what kgeography does is an image-processing. It distinguishes a division of the map by its’ RGB values. Then it identifies the division by Name, Capital, Flag etc parameters given in the kgm file for that division.

So, for adding a map we need to do following things:

1. First, create the map using GIMP, Kolourpaint or any other picture editors. Getting a political outline will be the best idea. I couldn’t get one atleast for India. So a good idea will be superimpose a blank outline map over a descriptive political map (in two layers to be precise). Assign separate colours for every division. Care should be taken that no two regions should have same colours. Ofcourse, handdrawn & scanned political outline maps may be an option and there is no real restriction on the scale of the maps.

2. Next, comes the integration part or the kgm file. So lemme show the basic structure of the .kgm file:

<map>

<mapFile>mapname.png</mapFile>
<name>MapName</name>
<division>

<name>DivisionName</name>
<flag>flagname.png</flag>
<capital>CapitalName</capital>
<color>

<red>255</red>
<green>255</green>
<blue>255</blue>

</color>

</division>
...............................
//Other divisions
...............................

</map>

A kgm file begins with <map> and ends with </map>. Inside of those tags there are:

  • <mapFile> and </mapFile>: the name of the file (without any path) containing the map image, e.g. “india.png”.
  • <name> and </name>: the name of map, e.g. “India”.
  • A <division> and </division> for each division in the map.

Now, each division has these tags:

  • <name> and </name>: the name of the division, e.g. “West Bengal”.
  • <capital> and </capital>: the name of the capital of the division, e.g. “Kolkata”.
  • <ignore> and </ignore>: can be set to yes, allowClickMode and no. If this tag is set to yes then the division will be ignored when asking for divisions in that map. It is then as if this division does not exist in KGeography quiz modes. If this tag is set to allowClickMode then KGeography will ask for the division in the Click Division in Map… mode but not in other quiz modes. Setting this tag to no means the division will appear in all modes (browse and quizzes). This tag is optional and when there is no <ignore> tag that means as it is set to no. For example “Egypt” has this tag set to yes in the “Asia” map which means that “Egypt” will not be part of any quiz in the “Asia” map. Also this tag is set to yes for frontiers or oceans.

<division>

<name>Not a Nation</name>
<ignore>yes</ignore>
<color>

.........................................

</color>

</division>

  • <flag> and </flag>: the file (without any path) containing the flag of the division, e.g. “india.png” in asia map. This tag is optional. Not needed for the divisions whose <ignore> tag is set to yes.
  • <color> and </color>: the color the division has in the map.

The color is defined using three tags:

  • <red> and </red>: red component of the color. Valid values are between 0 and 255.
  • <green> and </green>: green component of the color. Valid values are between 0 and 255.
  • <blue> and </blue>: blue component of the color. Valid values are between 0 and 255.

All names should be in english. But when number of divisions are too much it will be better to automate the task of creating kgm file with a bash script (will post lil’bit later). I checked out the helper tool in kgeography handbook which wasn’t effective enough even on the existing maps.

Update: Now, this post may not be enough to dive into this work. So, I created a sort of presentation concentrating on how to add the map of India. It’s still unfinished. But you can have the first cut from here: [http://makghosh.googlepages.com/addmaps.pdf]. The best way to see it is as a presentation in kpdf.

Well, I divided the task in 3 days:

  1. Day 1: Create the political map of India (done)
  2. Day 2: Color the divisions of the map (done)
  3. Day 3: Create the .kgm file (not completed)

Have fun!! And do post any comments or improvements :)

About these ads