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.
API Examples
Use these maps as starting points for your own projects.
- 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.
