next up previous
Next: Bibliography

\begin{figure*}
\renewedcommand{xyWARMinclude}[1]{\scaledfig{.7}{ ...

Annotating a Map of the World using WARMreader

The map shown on the previous page was designed to test the flexibility of the WARMreader macros, described elsewhere(1) in this volume. For a map of the world, the idea was to place textual annotations (typeset with TEX), and ornaments such as a dot, star, or other graphic, referring to particular cities. Locating the correct place for the annotations is done entirely from knowledge of latitude and longitude coordinates. Appropriate TEX macros were written to read the latitude/longitude data from existing files, and use that data to calculate appropriate positions over the area covered by the map graphic.

The map image came from the Perry-Castañeda Library Map Collection at the University of Texas, which is accessible online (2). It has maps originally drafted for the American CIA (3), scanned and presented in a variety of formats. A ``Political'' map, from worldmaps/WorldPol98.jpg in JPEG format, was chosen for plain colours and clear boundaries. Some alteration of the colours was done, using the xv graphics utility, to lessen the intensity of the blues, browns and blacks so that annotations could be read more easily. It uses the unconventional ``Robinson'' projection, which was developed (4) for Rand McNally & Co., and used by them for maps published in the National Geographic magazine, and for use in schools. One aspect of this projection is that there is no easy mathematical formula to describe it. Instead, conversion from latitude/longitude values is performed using quadratic interpolation between tabulated values. This is described in (4) and some computer code is given in (5). Appropriate TEX code was developed for WARMreader to do these calculations.

The .bb file contains the following information:

  %%BoundingBox: 0 0 1280 747
  %%ContentsBox: 23 69 1243 687
  %%MapProjection: Robinson (10,0)
in which the 2nd line records the extents of the world map inside the whole graphic. The (10, 0) indicates that the center of the map falls at longitude 10oE rather than on the 0o-meridian. With this information, and knowing that a Robinson projection is being used, latitude/longitude values can be converted to the appropriate position over the graphic.

Latitude and longitude values came from several sources. Firstly, data for 120 cities world-wide is contained in the file CityData.m that comes with the Mathematica(6) software. After more than 100 lines of code, the relevant data is presented as follows (ignoring blank lines):

  (* City Information *)
  CityPosition["Abu Dhabi"] = {{24, 28}, {54, 25}}
  CityPosition["Addis Ababa"] = {{9, 3}, {38, 42}}
   ...
The pairings give degrees and minutes of arc; some entries contain a third number for seconds of arc. Note that extracting the values from these lines requires adjusting the \catcode of characters: {}". Within CityData.m, the data is attributed to other sources.

Further values were obtained from files found at a Bahá'í web page1. There are three files, for USA, Canada, and other countries. After copying, and removing unnecessary text, the data was presented in the form:

  Look-up Latitude and Longitude
   AFGHANISTAN
     Kabul     : 34o 35' N  69o 12' E
   ALGERIA
     Algiers   : 36o 46' N  30o 3' E

The o and ' symbols are actually 8-bit latin-1 characters, with octal codes \260 and \264 respectively. Over 200 world cities are listed this way. To read and extract this data from files using TEX, \catcode changes are again necessary.

Since country names are given as well as city locations, this information was retained to be able to resolve clashes in case more than one city has the same name. This was very important since another 900 or so locations are given in the files for the USA and Canada. Name clashes are rife. For these listings, the data is not actually for cities, but for airfields associated with cities and towns, grouped according to states or provinces. Some editing was needed to remove unnecessary information markers, indicating whether the airfields are for commercial or military purposes. The original source of the information was not apparent from the web site.

Storing information for more than 1200 geographic locations exhausts memory on standard TEX installations, especially when also the LATEX and XY-pic macros are loaded. The memory available to hugelatex suffices.

All the locations are marked with a red dot, using a larger size for those in the world cities listings. Cities of current or future special significance to TUG (Portland, Stanford, Vancouver, Oxford) or the authors of WARMreader (Los Angeles, Sydney, Montreal) are marked with a star, and have a textual annotation. These are achieved using code snippets such as:

 \xyMarkedPos{Sydney.AUSTRALIA}*[yelloworange]
  {\star},*+!L\txt\tiny{Sydney}
  ,*+<6pt>!D!L(.5)\txt\tiny\textit{Ross lives here.}

 \xyMarkedPos{Vancouver}*[yelloworange]{\star},="99"
  ,*+<2pt>!DL\txt{\white{Vancouver}}="k"
  ,+R*!L{\lionBeige}
  ,"k"*!L+++!D\txt{\white{site for TUG'99}}
The \xyMarkedPos macro determines the position using the name Vancouver or Sydney.AUSTRALIA (to distinguish from Sydney.NOVA SCOTIA).

Cities where TUG meetings have been held were marked with a $ \star$, and annotated with the place name, year and a lion-head logo. This logo is familiar to long-time users of TEXTURES; formerly it was their logo. A bitmap version of the graphic is on the TEXTURES installation CD (7). For the map an .eps version was created, as well as versions with coloured backgrounds to be placed on the map over sea or land. Many of those cities were not listed in the files read by WARMreader. For these, latitude/longitude information was obtained from the Astrodienst online atlas, which accesses a database of more than 256,000 cities, towns and suburb names.

% declare extra data points; syntax as in the files
%
\DeclareExtraCityData
\declareWRMdata{Oxford : 51o46' N 1o15' W}{UNITED KINGDOM}\LatLongPattern
\declareWRMdata{Dubna : 54o9' N 36o58' E}{RUSSIA}\LatLongPattern
...

These, and other TUG meeting places, were marked with a coloured star and given a shortened XY-pic name:

 \xyMarkedPos{Dedham}*[yelloworange]{\star},="91",
 \xyMarkedPos{Cork}*[yelloworange]{\star},="TeX90",
 \xyMarkedPos{College Station}*[yelloworange]
  {\star},="90",

The short name is used to help position the lion icon and annotation at the top or side of the map, and draw an arrow to the star; e.g.

 ,"map"!"TeX90",+U+/d.5cm/,+/l1.5cm/*+!U{\lion},+CR
   ,*!L\txt\tiny{Cork, \TeX'90},+CD;p,{\ar"TeX90"}
 ,"map"!"98",+U+/d.5cm/,+/l0cm/*+!U{\lion},+CR
   ,*!L\txt\tiny{Toru\'n, TUG'98},+CD;p,{\ar"98"}
Here the "map" denotes the rectangle of the map. Coding such as "map"!"TeX90",+U locates the position along the top edge directly above the point saved as "TeX90". This enables the subsequent XY-pic code to calculate an appropriate position and alignment for the annotations related to the specified city.

At the TUG'99 meeting, the map was displayed in colour. This had been printed from a PDF file, created using pdflatex. It also had a table listing the number of TUG members in countries around the world. This file is available at http://www.tug.org/TUG99-web/WARMmap.pdf.




next up previous
Next: Bibliography
Ross Moore 1999-09-17