Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function GoogleMap_selected(){
- var lattitude_value= document.getElementById('slectedLat').value;
- var longitude_value= document.getElementById('slectedLon').value;
- var from = new google.maps.LatLng(mylatitude, mylongitude);
- var to = new google.maps.LatLng(lattitude_value, longitude_value);
- var directionsService = new google.maps.DirectionsService();
- var directionsRequest = {
- origin: from,
- destination: to,
- travelMode: google.maps.DirectionsTravelMode.DRIVING,
- unitSystem: google.maps.UnitSystem.METRIC
- };
- this.initialize = function(){
- var map = showMap_selected();
- directionsService.route(
- directionsRequest,
- function(response, status)
- {
- if (status == google.maps.DirectionsStatus.OK)
- {
- new google.maps.DirectionsRenderer({
- map: map,
- directions: response
- });
- }
- else
- {
- alert("Unable to retrive route");
- }
- }
- );
- }
- var showMap_selected = function(){
- var mapOptions = {
- zoom: 12,
- center: new google.maps.LatLng(lattitude_value, longitude_value),
- mapTypeId: google.maps.MapTypeId.ROADMAP
- };
- var map = new google.maps.Map(document.getElementById("selected_map_canvas"), mapOptions);
- return map;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement