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
Search example 2
jsfiddle
Script
Map
Json
1
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Start
var service = new navmii.maps.SearchService(); var request = { q: "Champ de Mars", location: new navmii.maps.LatLng(48.853384, 2.297195), top: 5, r: 5000 }; wait(1); showMapTab(); service.search(request, function (response, status) { wait(0); if (status === navmii.maps.SearchStatus.OK) { showText(JSON.stringify(response, null, ' ')); showResult(response); } else { showJsonTab(); showText('Error: ' + navmii.maps.SearchStatus[status] + "\n" + JSON.stringify(response, null, ' ')); } }); function showResult(d) { var map = new navmii.maps.Map(document.getElementById('map'), { zoomControl: true }); var fgr = new navmii.maps.FeatureGroup().addTo(map); var br = '<' + 'br>', bs = '<' + 'b>', be = '<' + '/b>'; for (var i = d.items.length - 1; i >= 0; i--) { var item = d.items[i]; var opt = { position: new navmii.maps.LatLng(item.lat, item.lng), color: i === 0 ? 'red' : 'blue', content: i + 1, zIndexOffset: d.items.length - i }; var marker = new navmii.maps.Marker(opt); fgr.addLayer(marker); var text = bs + 'name: ' + be + item.name + br + bs + 'address: ' + be + item.address + br + bs + 'location: ' + be + item.lat.toFixed(5) + ',' + item.lng.toFixed(5) + br + bs + 'category: ' + be + item.categories.join(',') + br + 'result #' + (i + 1); marker.bindPopup(text); } map.fitBounds(fgr.getBounds()); }