BAR may the most searched placed if you are new the location. Finding a good bar in the locality is most beneficial as you don't need to do drink and drive. Visit the bar nearby and have a good time along with the drink. We don't in any way promote alcohol, however it is individual choice and decision. The standard disclaimer of liquor is harmful for your body. Though all the latest maps have the feature of showing the bars near you, we thought why we should not build an open webpage based on the open-source information and provide the required information. There are very high chances of information provide being wrong, however having some information is better that of knowing no information.
This webpage has the two options, wherein the system can detect your location and provide the details and how far it's from current location or you can enter the location and then system will provide you the list of information.
Nearest BAR Finder
Find the Nearest BAR to my location
....
encodeURIComponent(address);
$.getJSON(geocodeUrl, function(data) {
if (data.length > 0) {
var lat = data[0].lat;
var lng = data[0].lon;
searchAutoStands(lat, lng);
} else {
alert("Location not found. Please enter a valid address.");
}
});
}
// Common function to search for auto-rickshaw stands based on latitude and longitude
function searchAutoStands(lat, lng) {
var userLocation = [lat, lng];
// Set the map view to the specified location
map.setView(userLocation, 15);
// Place a marker at the specified location
L.marker(userLocation).addTo(map).bindPopup("Search Location").openPopup();
// Query Overpass API for nearest auto-rickshaw stands
var overpassUrl = "https://overpass-api.de/api/interpreter";
var query = `
[out:json];
node
["amenity"="bar"]
(around:5000,${lat},${lng});
out;
`;
$.get(overpassUrl, { data: query }, function (data) {
var results = data.elements;
if (results.length > 0) {
displayResults(results, userLocation);
} else {
alert("No BAR found nearby. check any maps or ask anyone");
}
});
}
function displayResults(results, userLocation) {
var table = '';
results.forEach(function (place) {
var placeLocation = [place.lat, place.lon];
var distance = (calculateDistance(userLocation, placeLocation) / 1000).toFixed(2); // Convert to km
// Add a marker for each auto stand
L.marker(placeLocation).addTo(map).bindPopup(place.tags.name || "Unnamed BAR");
// Construct the address and contact details if available
var details = (place.tags.name || 'Unnamed BAR') + ' ';
details += (place.tags['addr:street'] ? place.tags['addr:street'] + ', ' : '') + (place.tags['addr:city'] ? place.tags['addr:city'] : '') + ' ';
details += 'Contact: ' + (place.tags['contact:phone'] || 'N/A');
table += ``;
});
table += '
Details
Distance (km)
${details}
${distance}
';
$('#divTable').html(table);
}
// Function to calculate the distance between two lat/lng points in meters
function calculateDistance(coords1, coords2) {
var R = 6371e3; // Earth radius in meters
var lat1 = coords1[0] * Math.PI / 180;
var lat2 = coords2[0] * Math.PI / 180;
var deltaLat = (coords2[0] - coords1[0]) * Math.PI / 180;
var deltaLng = (coords2[1] - coords1[1]) * Math.PI / 180;
var a = Math.sin(deltaLat / 2) * Math.sin(deltaLat / 2) +
Math.cos(lat1) * Math.cos(lat2) *
Math.sin(deltaLng / 2) * Math.sin(deltaLng / 2);
var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
return R * c; // Distance in meters
}
]]>
LG Q7 receives FCC certificationThe LG Q7 is methodically gathering the certifications needed before official launch. After it became clear a couple of days ago that it's b…Read More...
0 Response to "Bar Near Me"
Post a Comment