Political Map for Marble

I am glad that I accomplished my first task to integrate political map with marble. 🙂 . I finished its implementation last week.

Here is a look must1

The main feature I implemented is the support to specify different colors for different regions of map in .dgml file ( theme file for Marble ) . So, if the placemarks in map data file contains color indices then the placemarks are assigned different fill colors based upon the color index they have. The different color indices of placemarks are mapped to the colors you specify in theme file. Political map uses the same logic. So, one can customize the colors with which the countries are being colored by specifying the custom colors in theme file. Further to achieve this I also modified the pn2 format ( a memory efficient format that Marble uses to store map data ) to store color indices in it


Other than this I fixed the issue of correctly determining inner and outer boundary of a polygon. I found this problem when I noticed that some of the countries are not being displayed on map and I need to zoom in to see them. This was the most challenging thing in whole task to figure out why it’s happening.  At last I tracked down this weird problem and fixed it. Meanwhile I also designed a patch for not parsing the map data file again on theme change ( if it has been parsed already ) if the new theme just changes the fill color or pen color, instead just change the style  info of placemark.

Currently you can browse through political map and get basic information ( like population, some basic history, area, flag etc. ) about a country by clicking on its name. The image below displays the information about Egypt :


So, continuing my work this week I started working on highlighting a particular region on map when you click on it. I have designed an initial patch for it. Tosten and Dennis gave it a quick review and suggested me some changes. So, I need to fix them all first. Anyways, here is a quick view what it looks like ( Italy has been highlighted image below ) :


So, I’ll be busy this week fixing the issues with ‘highlight on click’ patch. Stay tuned as more interesting feature to come ahead 🙂 .

This entry was posted in Uncategorized and tagged , . Bookmark the permalink.

10 Responses to Political Map for Marble

  1. anonymous says:

    In your 4th image only part of the Italian territory is highlighted (islands like Sardinia and Sicily are excluded), is this intended?

    • abhgangwar says:

      Thanks for reporting. This is because the polygons containing the islands Sardinia and Sicily are in different placemarks than the placemarks containing the highlighted portion of Italy. That’s why clicking on the larger polygon applied highlighted style to only one placemark and left the placemarks containing Sardinia and Sicily with normal style. If all the polygons which constitute Italy in map are in same placemark then clicking anywhere on territory of Italy will highlight whole of Italy area. I’ll fix it. Thanks again.

  2. redsteakraw says:

    Is this going to be the basis for a Marble based Kgeogray and Krisk?

  3. Pingback: Links 7/6/2014: ‘Linux is Everywhere’, Valve Games Milestone (500) | Techrights

  4. Richard says:

    Thanks, for the update! 🙂
    I noticed in the screenshots, that at least one color appears twice. Is the number of colors hardcoded or theme specific? In any case I think it should be increased.

    Also it would be nice if this could be used for federal states, too. E.g. you select one country and there would be an option to show the federal states of just that country.

    • abhgangwar says:

      Hi Richard, Thanks for suggestion. Yes, I agree that map would look nicer if we’re able to get more colors. Map data from naturalearthdata.com provides three versions of color indices – mapcolor7, mapcolor8, mapcolor9 and mapcolor13 . Also, mapcolor 7 has vaues in range [1,7] , mapcolor8 lies in range [1,8] and so on. We are using mapcolor13. So, at maximum I can map these color indices values to 13 different color. These color indices, in data file ,are written in way so that no two adjacent countries get same color. You can specify, in theme file, which 13 colors you want ( but the no. is currently restricted to 13 ). So, I’m afraid that we can’t increase color number until we find a way to assign countries color indices keeping the constraint that no adjacent countries get same color index.
      It would be great to have federal states for countries but IIRC currenlty naturalearthdata.com provides federal states data only for Unites States.

  5. Pingback: Marble Game – Identify the country shape | Abhinav's Blog

  6. Gary says:

    Greetings! Thank you for all your hard work. This is exactly what I need, but I can’t find anywhere to download it. Can you help?

  7. abhgangwar says:

    If you need the source code, you can download it from here git://anongit.kde.org/marble and find the code for the game in the director `examples/cpp/marble-game` in source tree.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s