Multimap API V1.2 JavaScript 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 map viewer in pixels, as an MMDimension object. This is especially useful when you have allowed the browser to define the size of the map 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 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 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://clients.multimap.com/API/maps/1.2/demo"></script>
Sorry, JavaScript required...
Sorry, JavaScript required...
For more information on the subject of Multimap API JavaScript code, please read the API documentation at: http://clients.multimap.com/share/documentation/api/1.2/classes/.
If you require further help with your Multimap service implementation, additional Multimap services or general account enquiries, please contact Multimap:
| Sales: | +44 (0)20 7632 7800 |
| Customer Support: | +44 (0)20 7632 7777 |
| email: | mminform@microsoft.com |