MAP Web Author JavaScript API
The MAP Web Author JavaScript API allows developers to embed and interact with maps produced by MAPublisher in web pages.
This site was developed as a guide to the API and is available to all MAPublisher customers.
Getting Started
Getting going with using the API is easy.
Step 1: Export your map to web from MAPublisher. Ensure that you set the "Flash Player Security Sandbox" setting to "NETWORK".
Step 2: Add the folder that you exported your map to the list of trusted sites for Flash Player here.
Step 3: Start coding! The default html page generated for your map already contains the script elements needed to use the API.
<script type="text/javascript" src="index_data/swfobject.js"></script>
<script type="text/javascript" src="index_data/avenza.js"></script>
<script type="text/javascript">
AVENZA.embedViewer("map", "792", "612",
{
baseURL:"index_data/",
flashSecuritySandbox: AVENZA.NETWORK_SANDBOX
}
);
</script>
All you need to do is take the object reference returned by AVENZA.embedViewer and start calling methods on it.
var theMap = AVENZA.embedViewer("map", "792", "612",
{
baseURL:"index_data/",
flashSecuritySandbox: AVENZA.NETWORK_SANDBOX
}
);
// zoom in the viewer!
theMap.zoomIn();
More Information
Check out the JavaScript API reference for a full listing of all available functionality.
The Web Author FAQ section contains answers to common questions for API users.
How Do I? ...
Use these simple example maps as starting points for your own projects.
- Set map parameters
- Run a function after the map has finished loading
- Control map panning and zooming
- Hide and show layers
- Search in the map
- Get the attributes for the map feature that the mouse is over
- Get the attributes for the map feature that has just been clicked on
- Set attribute values for features in the map at run time
- Highlight map features
- Show a callout for a map feature
- Zoom in on a specific feature in the map view
API Examples
These completed example maps demonstrate how to create great content using the Map Web Author API.
- JavaScript API Example - demonstrates all available API functionality.
- Central Park, New York City - shows how to use our API to integrate with external web services like Google Maps.
- US Current Weather - an example of how to integrate live data from external sources into a web map.
- H1N1 Timeline Animation - shows how to use the API to create an animated timeline map.
