7667538694

support@kosiservice.com

Adarsh Colony Road No. 1, Khemnichak, East Lakshmi Nagar, Ramkrishan Nagar, Sampatchak, Patna, Bihar 800027

Feel Free to Get in Touch

Name*
phone
email*
subject*
message*

Support Time 10.00AM to 07.00PM All day open

contact img
function initMap() { // Create a map object and specify the DOM element for display var map = new google.maps.Map(document.getElementById('map'), { center: {lat: 40.7128, lng: -74.0060}, // Initial center coordinates (New York City) zoom: 12 // Initial zoom level }); // Create a DirectionsService object var directionsService = new google.maps.DirectionsService(); // Create a DirectionsRenderer object var directionsRenderer = new google.maps.DirectionsRenderer({ map: map }); // Function to update the origin marker on the map function updateOriginMarker() { // Reference to the location of Kosipartner in the database var kosipartnerRef = database.ref('KosiService/KosiHelper/VsGAvfiMmZd1KqQjgwMPh9jGCpz1'); // Listen for changes in the database kosipartnerRef.on('value', function(snapshot) { // Get the new geocoordinates var kosipartnerLocation = snapshot.val(); print(snapshot.val); // Update the marker position on the map if (kosipartnerLocation) { var kosipartnerMarker = new google.maps.Marker({ position: {lat: kosipartnerLocation.latitude, lng: kosipartnerLocation.longitude}, map: map, title: 'Kosipartner' }); } }); } // Set the origin and destination for the directions request var origin = new google.maps.LatLng(40.7128, -74.0060); // Destination coordinates (New York City) var destination = new google.maps.LatLng(40.7357, -74.1724); // Kosi Service coordinates (New York City) // Set the request parameters var request = { origin: origin, destination: destination, travelMode: google.maps.TravelMode.DRIVING // Specify driving mode }; // Send the request to the DirectionsService directionsService.route(request, function(response, status) { if (status == google.maps.DirectionsStatus.OK) { // Display the directions on the map directionsRenderer.setDirections(response); } else { window.alert('Directions request failed due to ' + status); } }); // Call function to update origin marker updateOriginMarker(); }