Multimap Open API V1.2 Example
This example demonstrates how to use the Multimap Open API's optional Routing module to calculate routes and present travel directions in a list and on a map.
You can use the Multimap Open API to show and describe a highlighted route between two locations (including intermediate 'via' points, if required) while controlling the restrictions on the routes that are available and the language in which travel directions are presented.
The Routing module of the Multimap Open API can generate routes that link numerous locations: it achieves this by processing a list of locations, treating the list's:
If you view this in your browser you should see a Multimap draggable map centered on the city of Naples, Italy, at zoom factor 15.
To generate a route:
In this example you can include one or two intermediate locations (or 'via' points):
A journey with 'via' points is listed beneath the map in separate stages, each of which can show its individual start and end points, distance, duration and an 'abstract summary' of the steps that are involved in that stage of the route (such as a list of major roads).
If you have selected the option to calculate a route (outside North America) that avoids highways or motorways, the Multimap Open API calculates the route accordingly.
If you have selected the option to optimize a route (outside North America) that contains 'via' points, the Multimap Open API rearranges the order of the intermediate locations to provide the most efficient possible route.
Please note that, in this example, you must populate the drop-down lists of locations from the top list downwards; for example, if you enter data in the box whose label is "Location 3", you must also enter data in "Location 1" and "Location 2".
Important note: You must display copyright and disclaimer notices when providing travel directions.
|
|
|
Messages and results will be placed here
|
|
There are four 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. Finally, the fourth is the CSS code that you should add to your web page.
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" >
<script type="text/javascript" src="http://developer.multimap.com/API/maps/1.2/OA08061815803962482"></script>
Sorry, JavaScript required...
Sorry, JavaScript required...
Sorry, JavaScript required...
Sorry, JavaScript required...
Sorry, JavaScript required...
Please note that you may not be able to print a highlighted route or a polyline from the Multimap Open API when using a Mozilla Firefox or an Opera browser. If you encounter such a problem, please try a different browser.
For more information on the subject of Multimap Open API JavaScript code (including error codes for the Routing module), 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 |