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
Geocoding example 2
jsfiddle
Script
Map
Json
1
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
1
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Start
var service = new navmii.maps.Geocoder(); var sw = new navmii.maps.LatLng(49.25588, 4.029889); var ne = new navmii.maps.LatLng(49.27588, 4.049889); var request = { address: "43 Rue Gosset Reims", bounds: new navmii.maps.LatLngBounds(sw, ne), limit: 5 }; wait(1); showMapTab(); service.geocode(request, function (response, status) { if (status === navmii.maps.GeocoderStatus.OK) { showText(JSON.stringify(response, null, ' ')); showResult(response); } else { showJsonTab(); showText('Error: ' + navmii.maps.GeocoderStatus[status] + "\n" + JSON.stringify(response, null, ' ')); showResult(null); } wait(0); }); 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 = 0, len = d.items.length; i < len; i++) { var item = d.items[i]; var opt = { position: new navmii.maps.LatLng(item.lat, item.lng), color: i === 0 ? 'blue' : 'gray', content: i + 1 }; var marker = new navmii.maps.Marker(opt); fgr.addLayer(marker); var text = bs + 'name: ' + be + item.adminPath + br + bs + 'location: ' + be + item.lat.toFixed(5) + ',' + item.lng.toFixed(5) + br + 'result #' + (i + 1); marker.bindPopup(text); } map.fitBounds(fgr.getBounds()); }