Multimap Open API V1.2 Example
There are several general methods that you can use to ascertain properties of the map viewer:
mapviewer.getCurrentPosition()
This returns the current position at the center of the map as an MMPoint.
mapviewer.getDimensions()
This instruction retrieves the dimensions of the viewer in pixels, as an MMDimension object. This is especially useful when you have allowed the browser to define the size of the viewer, instead of styling the container to a specific size.
mapviewer.getMapBounds()
This instruction returns the bounds of the map using the appropriate coordinate system as an MMBox object (which provides right/left/top/bottom properties).
mapviewer.getVersion()
Finally, this instruction retrieves the full version of the Multimap Open API, including revision number.
MultimapViewer: beenDrawn() *new*, getBrowserDimensions(), getClient(), getContainer(), getCurrentPosition(), getDimensions(), getInnerDimensions(), getMapBounds(), getVersion(), resize()
If you view this in your browser you should see a Multimap draggable map centered on Saint James Avenue, Boston, Massachusetts, USA, at zoom factor 15.
Clicking on each of the links updates the message window below the map. As you drag the map and click the links again, the current position and map bounds change.
You can alter the size of the map on the page by specifying new height and width values (in pixels) in the "New dimensions" box.
Please note that Multimap's recommended limits on draggable map size are:
| Messages will be placed here | |
There are three parts to the code below. The first is the line that links to the Multimap Open API. The second is an example of the HTML you must have in your page. The third is an example of the JavaScript required to implement the page.
<script type="text/javascript" src="http://developer.multimap.com/API/maps/1.2/OA08061815803962482"></script>
Sorry, JavaScript required...
Sorry, JavaScript required...
For more information on the subject of Multimap Open API JavaScript code, please read the Multimap Open API documentation at: http://www.multimap.com/share/documentation/openapi/1.2/classes/.
If you require further help with your Multimap Open API implementation, please visit the Multimap Developer Forums.
For Open API news, announcements and other information, please see our blog.
For general account enquiries or further services, please contact the Multimap Sales team:
| London, Great Britain | +44 (0)20 7632 7800 |
| email: | sales@multimap.com |