Toggle navigation
Navmii livemap API beta
Geocoder
Geocoding example 1
Geocoding example 2
Reverse geocoding example 1
Reverse geocoding example 2
Routing
Example 1
Example 2
Example 3
Search
Example 1
Example 2
Routing example 3
jsfiddle
Profile
fastest
shortest
fastest_notolls
shortest_notolls
Bearings
Radiuses
Alternatives
true
false
Script
Map
Json
1
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Start
(function (app) { var profile = document.getElementById('profile'), bearings = document.getElementById('bearings'), radiuses = document.getElementById('radiuses'), alternatives = document.getElementById('alternatives'); var directionsService = new navmii.maps.DirectionsService(); var map = new navmii.maps.Map(document.getElementById('map'), { zoomControl: true }); function onMarkerDragEnd(coords) { app.coords = coords; route(); } var renderer = new navmii.maps.DirectionsRenderer({ map: map, draggable: true, onMarkerDragEnd: onMarkerDragEnd }); function route() { var request = { origin: new navmii.maps.LatLng(49.26588, 4.039889), destination: new navmii.maps.LatLng(47.927949, 1.92268), profile: profile.value, bearings: bearings.value, radiuses: radiuses.value, alternatives: (alternatives.value === "true") }; if (app.coords) { request.origin = app.coords[0]; request.destination = app.coords[app.coords.length - 1]; } wait(1); directionsService.route(request, function (response, status) { wait(0); if (status == navmii.maps.DirectionsStatus.OK) { showMapTab(); renderer.setDirections(response); showText(JSON.stringify(response, null, '\t')); } else { showJsonTab(); showText('Error: ' + navmii.maps.DirectionsStatus[status] + "\n" + JSON.stringify(response, null, '\t')); } }); } if (app.onChange) { profile.removeEventListener('change', app.onChange); alternatives.removeEventListener('change', app.onChange); } app.onChange = function onChange(e) { route(); }; profile.addEventListener('change', app.onChange); alternatives.addEventListener('change', app.onChange); route(); })(window['app'] = window['app'] || {});