Multimap logo Multimap API V1.2 JavaScript Example

Using the Multimap API Geocoder

This example shows how to work directly with the geocoding features of the Multimap API. It shows how to work directly with the MMGeocoder class, including the handling of multiple results from the geocoder.

The geocoder returns results in UTF-8 format. You should ensure that the encoding of your HTML page is set to UTF-8 using a header similar to the following:

<meta http-equiv="content-type" content="text/html;charset=UTF-8">

Single-line geocoding *new*

The Multimap API now allows you to geocode an address by processing it as a single string; in this example, this is done via the qs parameter (abbreviated from "quick search").

Function(s) introduced:

MultimapViewer: getAutoScaleLocation()
MMGeocoder: geocode()

What You Should See

If you view this in your browser you should see a Multimap draggable map centered on Carrington Street, Sydney, Australia, at zoom factor 15. To the right of this map is a column of labelled data-entry fields.

If you enter an address into the form (as either a single-line address or a combination of separate address elements) and click on the appropriate Geocode button, you will be presented with a map of your address, a list of possible matches or an error message (which is the typical result if no matches have been found).

Please note that the list of countries presented in this example is purely for demonstration purposes and is not an exhaustive list.
For details of permissible values for countries, states and regions, please see Multimap's Countries and States web page and, for further information on the list of address parameters that the Multimap API recognizes, please see the Multimap API Geocoding web service documentation.

The Map

Geocode address:
... or:



Messages and results will be placed here

The Code

There are three parts to the code below. The first part shows the headers that you should have in your page, to ensure your page uses UTF-8 encoding, and to link 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.

The header code

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

The body code

Sorry, JavaScript required...
Sorry, JavaScript required...
Sorry, JavaScript required...

The JavaScript code

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

Back to examples.


Further Help

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