In this tutorial, we will guide you through the process of creating a map theme based on tiled images, where these images are used as a texture for the earth and are available in different resolutions for each zoom level.
The basic steps you have to take are as follows:
Contents |
You must first decide whether you want your map theme to be visible for all users or only for the local user. Depending on your decision, the table below tells the path for you new map theme:
| all users | /usr/share/apps/marble/data/maps/earth/$YourMapTheme |
|---|---|
| local | ~/.local/share/marble/data/maps/earth/$YourMapTheme |
Inside $YourMapTheme, create a sub sub folder named "0/0" (mkdir -p 0/0).
Figure out the file format of the tiles and create an image with the correct file extension in the sub sub folder you just created. The content of the image is not important but make sure that the file extension is in lower case and that its dimension matches those of the tiles.
The preview image will show up in the map view of the navigation panel.
Create an image in $youmaptheme, e.g. preview.png.
Save the following template into a file named $YourMapTheme.dgml inside the $YourMapTheme folder.
<?xml version="1.0" encoding="UTF-8"?>
<dgml xmlns="http://edu.kde.org/marble/dgml/2.0">
<document>
<head>
<name>$YourMapName</name>
<target>earth</target>
<theme>$YourMapTheme</theme>
<icon pixmap="$PreviewImage"/>
<visible>true</visible>
<description><![CDATA[$YourMapDescription]]></description>
<zoom>
<discrete> true </discrete>
<minimum> 900 </minimum>
<maximum> 3500 </maximum>
</zoom>
</head>
<map bgcolor="#000000">
<canvas/>
<target/>
<!-- insert layers here -->
</map>
<settings>
<property name="coordinate-grid">
<value>true</value>
<available>true</available>
</property>
<property name="overviewmap">
<value>true</value>
<available>true</available>
</property>
<property name="compass">
<value>true</value>
<available>true</available>
</property>
<property name="scalebar">
<value>true</value>
<available>true</available>
</property>
</settings>
<legend>
<section name="coordinate-grid" checkable="true" connect="coordinate-grid" spacing="12">
<heading>Coordinate Grid</heading>
</section>
</legend>
</document>
</dgml>
Replace the following variables inside the DGML file:
Add this snippet inside the <map> tag in the dgml file and replace the variables according to the instructions below.
<layer name="$YourMapTheme" backend="texture" >
<!-- Schedule a re-download of tiles which are older than one year,
that is 31536000 seconds. -->
<texture name="map" expire="31536000" >
<sourcedir format="$FileExtension"> earth/$YourMapTheme </sourcedir>
<storageLayout levelZeroColumns="1" levelZeroRows="1" maximumTileLevel="19" mode="$IndexingScheme" />
<projection name="$Projection" />
<downloadUrl protocol="http" host="$Host" path="$Path" query="$Query" />
</texture>
</layer>
The remaining variables provide information about the remote server. Since there seems to be no common agreement of how tiles are layed out on different web services, Marble provides many options. Thus, this topic needs some explaination.
In the <downloadUrl> tag, you specify how Marble will request tiles from the remote server. The $Host, $Path, and $Query variables are used to create request URLs.
A key variable is $IndexingScheme, since it needs to fit the tile indexing scheme on the server. There are several indexing schemes Marble supports:
Replace the following variables according to the instruction above: