Multimap logo Multimap Open API V1.2 Example

Get Map Properties 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.

Function(s) introduced:

MultimapViewer: beenDrawn() *new*, getBrowserDimensions(), getClient(), getContainer(), getCurrentPosition(), getDimensions(), getInnerDimensions(), getMapBounds(), getVersion(), resize()

What You Should See

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.

The Map

Viewer's Status

Browser's Dimensions

Viewer's Container

Current Position

Viewer's Dimensions

Client Service Name

Viewer's Inner Dimensions

Map Bounds

API Version

New dimensions

Messages will be placed here

The Code

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.

The header code

<script type="text/javascript" src="http://developer.multimap.com/API/maps/1.2/OA08061815803962482"></script>

The body code

Sorry, JavaScript required...

The JavaScript code

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/.

Back to examples.

Further Help

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 enquiries about further Multimap services, please contact the Multimap Sales team:

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