svg-travel-map

Aaron Straup Cope

This work is licensed under the Creative Commons Attribution-ShareAlike License. To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/1.0/ or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.

Revision History
Revision 1.02004-09-15

Initial release.

Abstract

This is an XSLT 1.0 stylesheet for transforming an IndyJunior XML document into an animated SVG travel map.


Table of Contents

-

Usage

Example 1. 

 $> xsltproc --stringparam css_href 'default.css' --stringparam map_href 'world-1024.png' \
             svg-travel-map.xsl locations.xml > example.svg
	 

Consult the documentation for your favourite XSLT processor. This template accepts the following parameters :

  • title. String. Sets the document's title in the metadata section, using the Dublin Core namespace.

  • description. String. Sets the document's description in the metadata section, using the Dublin Core namespace.

  • publisher. String. Sets the document's publisher in the metadata section, using the Dublin Core namespace. If no value is defined then the URL of the XSLT processor is used.

  • language. String. Sets the document's language in the metadata section, using the Dublin Core namespace.

  • about. String. Sets the document's URI using the RDF namespace.

  • css_href. String. Sets the URL for the document's stylesheet.

  • travel_duration. Int. The number of seconds that a line connecting two locations will take to render. Default is 2.

  • map_href. String. Sets the URL for the document's map data. This package contains both a PNG and SVG map of the world, rendered at 1024 x 494 pixels.

  • map_h. Int. The height of the document's map data. Default is 494, the height of the world-1024 files included with this package.

  • map_w. Int. The width of the document's map data. Default is 1024, the height of the world-1024 files included with this package.

  • map_min_x. Int. The of the document's map data. Default is -180, the FOO of the world-1024 files included with this package.

  • map_max_y. Float. The FOO of the document's map data. Default is 83.674733, the FOO of the world-1024 files included with this package.

  • map_scale. Float. The scale used to render the document's map data. Default is 2.84444444444444, the scale used to render the world-1024 files included with this package.

  • map_decimals. Int. The number of decimal points used to render the document's map data. Default is 1, the number of decimal points used to render the world-1024 files included with this package.

You should be able to pass it the same XML file unaltered with two exceptions :

  • trans-Pacific travels must be indicated by a transpacific attribute.

    Example 2. 

    <location arrival="2004-11-01">
      <name>Sydney</name>
      <latitude>33S</latitude>
      <longitude>151E</longitude>
    </location>
    <location arrival="2005-01-01" transpacific = "true">
      <name>Honolulu</name>
      <latitude>21N</latitude>
      <longitude>157W</longitude>
    </location>
               
  • If you have two locations with the same arrival date, you will need to make sure that the dates are different. This is a limitation of XSL (I think) sorting that can be easily handled by speciying the date using a complete W3C datetime string.

    Example 3. 

    <location arrival="2005-01-01" transpacific = "true">
      <name>Honolulu</name>
      <latitude>21N</latitude>
      <longitude>157W</longitude>
    </location>
    <location arrival="2005-01-21T15:35:00" transpacific = "true">
      <name>Hong Kong</name>
      <latitude>22N</latitude>
      <longitude>114E</longitude>
    </location>

Requirements