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. Only access the Global Security Settings using this link, the required settings are not available by right-clicking on the Flash map.
Under Global Security Settings, enable the Always allow option and navigate to the folder where your map files are stored using Always trust files in these locations.
You will have to change the Global Security Settings for each individual browser as Flash settings are specific to each browser. We recommend using Firefox, Safari, and Internet Explorer when viewing maps that are stored locally.
When using Internet Explorer to open maps that are stored locally, you may be required to allow the browser to run local content. To do this enable Allow Active Content to Run Files on My Computer under Internet options > Advanced tab > Security
At this time you are unable to use Google Chrome to test files that are stored locally as the browser has a documented issue with its built-in Flash player that prevents users from adding a folder to the list of trusted sites. You can read more about this issue here. Your maps will work with all browsers when hosted on a network.
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 HTML5 API reference and Flash 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.
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.