GeolocationWithDotnet is a web application built using ASP.NET Core that calculates the distance between a user's current location and a specific destination provided as a Google Maps URL. The application leverages JavaScript's Geolocation API for obtaining the user's location and processes the distance calculation using the Haversine formula.
- Accepts Google Maps URLs as input.
- Utilizes the Geolocation API to retrieve the user's current location.
- Calculates the distance between the user and the destination using latitude and longitude values.
- User-friendly interface for entering the Google Maps URL and displaying results.
- Built with ASP.NET Core for backend processing and JavaScript for client-side geolocation.
Ensure you have the following installed on your system:
-
.NET Core SDK (v9.0 or later)
-
A modern web browser that supports the Geolocation API
-
Clone the repository:
git clone https://github.com/amaechijude/GeolocationWithDotnet
-
Navigate to the project directory:
cd GeolocationWithDotnet -
Restore the dependencies:
dotnet restore
-
Build the project:
dotnet build
-
Run the application:
dotnet run
-
Open your browser and navigate to
https://localhost:****.
- On the home page, paste a Google Maps URL into the input field.
- Allow location access when prompted by your browser.
- Click the "Calculate Distance" button.
- View the calculated distance in kilometers displayed below the input field.
Google Maps URL:
https://www.google.com/maps/place/Eiffel+Tower/@48.8588443,2.2943506
Your current location is approximately 12.5 km away from the Eiffel Tower.
- ASP.NET Core 9.0
- HTML5 and CSS3
- JavaScript (Geolocation API)
- Google Maps for destination URLs
- Haversine formula for distance calculation