Viewing the world with Xrmap

Digital Atlas


If you want to become an expert in world geography, why not get a little help from the CIA?

By Andreas Kneib

www.sxc.hu

Xrmap is a handy tool that provides access to a very interesting collection of data: the CIA Factbook. The Factbook [4] is a bundle of details from the CIA's extensive database.

According to the project homepage, the vector maps show a total of 20,000 cities, along with airports, mountains, and observatories. This data is all available in the packed archive file. Xrmap is your window to this bundle of data, giving users quick access via a GUI that will run on any X11 system.

Installing Xrmap

RPM and tar archives of Xrmap are available from the project homepage at [1]. If you prefer to install from source code, download the tarball, untar the archive and change to the directory:

tar xvjf Xrmap-2.33.tar.bz2
cd Xrmap-2.33/

The next step is to edit the Imakefile file. The variables in this file let you specify the directory where you will be installing the Xrmap program components:

XCOMM Install to /usr or /usr/local
DESTDIR=/usr

If you keep the default, parts of the software, such as manpages or binary files, will be placed below /usr in the directory tree.

Below the comment line XCOMM Default external utilities, you will find the external tools that Xrmap uses to view HTML pages and Postscript files, or to play midi files:

PS_VIEWER="gv -noantialias"
IM_VIEWER="display -background gray84"
HTML_VIEWER="dillo"
PRINT_CMD="lpr -Plp"
EDITOR="emx -fn 9x15"
MIDIPLAYER="timidity -ig"

If you prefer to use a different viewer from the default display tool, modify the IM_VIEWER variable to reflect your choice. This also applies to the other configuration variables in this section. In our lab we noticed that launching some text editors from Xrmap caused a few issues. For example, the Gvim editor just came up with empty pages.

As the default tools are all excellent programs, you may prefer to keep them rather than modifying Imakefile. You can always set command line options to change the external tools later.

The current Suse distribution includes Ghostview (gv), Timidity, and the Imagemagic package, which includes Display. The only program that most distributions will be lacking is Dillo, the fast web browser; you may need to download Dillo off the web [2]. Incidentally, the Emx editor is an Xrmap component.

After modifying Imakefile to suit your requirements, and saving the file, give the xmkmf command, and then enter make to build the program.

After make has completed the build, you should see a message telling you which external files the program needs. To be on the safe side, copy the text from the shell window into a text file; you may need to refer to this output later.

But let's concentrate on installing Xrmap first. To do so, enter the su command to become root. Then run the make -n install | less command to test if setup stores components such as the manpage in the specified directories.

If the test turns out to your satisfaction, become root and give the make install command. Time to turn our attention to the data files output in the message. The files include the compressed map CIA_WDB2.jpd.bz2, the flags-2.5-eps.tar.bz2 tarball with the national flags, or the CIA factbook in HTML format, titled factbook_html_2005.tar.bz2. The message sorts these files into the required, recommended, and optional categories.

Figure 1: The CIA Factbook gives users valuable information about countries around the world.

You can download this material from the project's ftp server at [4]. The files range from 26MB to 476MB, so you might like to base your decision on populating Xrmap on the bandwidth you have available.

After completing the download, move the files to the share directory specified by the SHAREDIR in Imakefile; this is /usr/local/share/rmap in our example. Then change directory to SHAREDIR, and unpack the compressed extensions:

cd /usr/local/share/rmap
for i in *.tar.bz2; do tar xvjf $i; done

Xrmap is now ready for use.

Cities, Countries, Rivers

Once you have navigated the Xrmap installation process, actually using the software is child's play. Type xrmap in a shell to launch the program. Xrmap comes up with a globe display.

Pressing the [+] key zooms in on a map. The minus key [-] scales the visible selection, and the arrow keys let you move around the map. As an alternative, you can right click a field on the map; the software will zoom this selection to give you a closer view.

The middle mouse button opens a menu where you can choose a number of options by clicking on the highlighted letters. As an example, the [O] key opens the editor for setting options. You can then select File and then the External Programs parameter in the submenu.

You can now modify the tool you specified previously in the Imakefile. Clicking the HTML browser box, and changing the text box from dillo to firefox, will tell Xrmap to use Mozilla Firefox for viewing the HTML pages in the CIA Factbook.

The options are quite extensive, covering topics ranging from printer configuration, maps you will be using, detailed color options, and search settings for countries, cities, and regions. You can also influence the way airports, mountain peaks, observatories, or longitudes and latitudes are displayed.

Keyboard shortcuts are the quickest way to access many parameters. The [I] tells you the names of cities; pressing [A] shows you the airports and their names. To view observatories, press the [B] key. Names of countries and oceans are displayed when you press [L], and pressing [P] for peak shows you mountain peaks.

You can press a key to toggle the view through displaying a city, displaying a city and its name, and hiding a city. The colon key [:] opens a topographical map of the selected region.

You are already familiar with the functions that the right and middle mouse buttons give you, so let's talk about the left mouse button. When you hover the mouse over a city and press the left mouse button, the City & Country infobox appears. This box gives you useful information on the city and the country that you highlighted. The window will tell you all about the state in which the city is located, and also fill you in on the state's geographical characteristics and population build-up.

For airports, Xrmap gives you the airport code and the length of the runway. For peaks, the program tells you which mountain range they belong to, along with the height of course.

No matter whether you select a city, a peak, an observatory, or an airport, the window next to it will give you details of the country and six buttons. From left to right, the buttons take you to country data, the CIA Factbook, the text of the national anthem, the tune of the national anthem, and the flag as a Postscript, PDF, or graphics file. The last button centers the image in the window.

As Xrmap knows at least 1,000 roads that lead to Rome, it also understands a large number of command line parameters. The manpage gives users an overview of the eighty or so options that you can set in the shell. You can either run man xrmap at the command line, or press the [H] for help key in Xrmap.

You can simply pass command line options to the tool instead of configuring shortcuts and settings. For example, you can tell the program to show +cities and +airports. To restrict the tool to a map of Europe, you would specify -continent 3, and you can load the country files in your editor by specifying -editor xedit.

To view the map for a specific location, specify the parameters -latitude and -longitude, for example: xrmap -latitude 52.520 -longitude 13.380 -zoom 10 ++cities.

This example takes Xrmap to a map of Berlin, Germany, scales the view tenfold (-zoom 10), and names the city (++cities). You can pick any spot on Earth.

Conclusion

Although installing from the source code may seem difficult, and although many add-ons are not exactly lightweight, Xrmap is a powerful, flexible, and surprisingly simple tool for studying world geography.

INFO
[1] Xrmap page: http://frmas.free.fr/li_1.htm#_Xrmap_
[2] Dillo web browser: http://www.dillo.org
[3] FTP server with add-on data: ftp://ftp.ac-grenoble.fr/ge/geosciences/xrmap/data/
[4] CIA Factbook: http://www.cia.gov/cia/publications/factbook