- Installation
- Placing pointMapper on a web page
- The pointMapper API
For an introduction to pointMapper, see "what is pointMapper?" nearby.
Placing pointMapper on a web page.
For working examples of pointMapper, see the examples directory in your installation.
PointMapper is placed in a web page by inclusion of two script elements. The first element specifies parameters that control size, position, and other aspects of pointMapper instance. For example:
<script type="text/javascript" language="JavaScript"> var pm_class = "mapclass"; // css class for the map var pm_color = "FFFFFF"; // background color for the map var pm_location = "../pointmapper/1.6"; // Location of pointMapper relative to this file </script>The second script element performs the instantiation of pointMapper on the page, and has the form:
<script type="text/javascript" language="JavaScript" src="../pointmapper/1.6/m.js"> // loads pointMapper scripts </script>
In the above example, it is assumed that the pointMapper server kit has been installed at a server URL that lies at the path ../pointmapper relative to the page, and that version 1.6 is wanted. PointMapper can be installed anywhere on your server. Wherever it is installed, the pm_location parameter, and the src attribute of the second script element should be set accordingly, for example:
pm_location = "/myinstall/pointmapper/1.6"; .... <script type="text/javascript" language="JavaScript" src="/myinstall/pointmapper/1.6/m.js"> // loads pointMapper scripts </script>
Only one instance of pointMapper may appear per page, although instances can appear in multiple frames or iframes.
A complete list of the available parameters follows:
pm_color
Specifies the background color of the map as a string of the form RRGGBB, where RR is the hexidecimal for the red intensity as a fraction of the maximum value (255, or FF hex), and GG, BB represent green and blue. Default value: "FFFFFF" (white).
pm_style
The instantiation script (m.js) produces an iframe into which the pointMapper Flash component is placed. The pm_style parameter sets the style attribute of this iframe element, and thereby controls size and placement of the map. For example,
pm_style = "position:absolute;left:470px;width:320px;top:650px;height:550px";
sets the pointMapper position and dimensions on the page to absolute values. See http://www.w3.org/TR/REC-CSS2/ for information about HTML styles; much flexibility in specifying position is available.
pm_class
The pm_class parameter sets the class attribute of the iframe element, and thereby allows control of the size and placement of the map from a style sheet rather than an in-line style. For example, the style sheet for the Manhattan map on the "what is pointMapper" page includes the definition:
.whatismap{ background-color: #ffffee;
position: absolute;
width: 320px; height: 550px;
left: 470px; top: 650px;
}
Therefore,
pm_class = "whatismap";
has the same effect as
pm_style = "position:absolute;left:470px;width:320px;top:650px;height:550px";
Typically, either pm_style or pm_class is specified, but not both.
pm_location
As explained above, pm_location gives the path to the pointMapper installation. The path may be specified relative to the page, as an absolute path within the server (eg "/myinstall/pointmapper/1.6"), or as a full URL ("http://www.myserver.com/myinstall/pointmapper/1.6").
pm_mapTitle
The string assigned to pm_mapTitle appears just above the map to the right of the viewing controls. The default value is "pointMapper" for licensed installations, or "Unlicensed Copy" if you have not purchased a pointMapper license. pm_mapTitle has no effect in unlicensed installations.
pm_identityService
If you are serving all content, including
point files and basemaps, from the same server as pointMapper, then this parameter is
not needed (this is the normal situation). However, to access XML content from other servers, you must specify
an identity script, whose effect is to support access to foreign XML via a local URL.
This script is required because of a security feature in the underlying
Macromedia Flash player, which prohibits Flash movies from loading
XML files from servers other
than the one hosting the current movie. The script identity.php is supplied with pointMapper
for this purpose. If your server supports PHP, set
pm_identityService to "identity.php". You can
write your own identity script (eg identity.py in Python), install it in the pointMapper
directory (eg
This completes the list of the parameters that appear in the first script element, prior to the pointMapper instantiation.
Usually, the parameter and instantiation script elements are followed by a third element containing initialization commands. For example:
<script type="text/javascript" language="JavaScript">
pm_loadMap("../basemaps/manhattan.1.xml");
</script>
This loads an initial map into pointMapper. The path to the xml file should given be relative to the versioned pointmapper directory (pointmapper/1.6), not relative to the file containing the map. The path "../basemaps/<mapfile>" will always work for basemaps in that appear in the usual place (ie <installDir>/pointmapper/basemaps). Other pointMapper API calls may appear in this initialization script element as well - for example, calls to set an initial zoom, or to load an initial set of points.
To summarize, here are the script elements that would place the Manhattan map on the page <installDir>/maps/samplemap.html :
<!--SET PARAMETERS-->
<script type="text/javascript" language="JavaScript">
var pm_class = "whatismap";
var pm_color = "FFFFee";
var pm_location = "../../pointmapper/1.6";// ../.. is the relative path to <installDir>
</script>
<!--INSTANTIATE-->
<script type="text/javascript" language="JavaScript"
src="../../pointmapper/1.6/m.js">
</script>
<!--INITIALIZE-->
<script type="text/javascript" language="JavaScript">
pm_loadMap('../basemaps/manhattan.1.xml');
</script>