joshuasarmiento / interactive-map-with-distance-calculation-and-custom-markers Goto Github PK
View Code? Open in Web Editor NEWHTML file that creates a Google Maps interface with various features and functionalities
HTML file that creates a Google Maps interface with various features and functionalities
# Interactive Map with Distance Calculation and Custom Markers This repository contains an HTML file that creates an interactive Google Maps interface with distance calculation and custom markers. The map allows users to visualize predefined locations, calculate routes between these locations, and display the distance and duration information for each route. ## Features - **Map Setup**: The map is centered on a specific location with a custom zoom level and map styles applied for a unique visual appearance. - **Markers and Pins**: A main marker and four fixed pins (labeled A, B, C, and D) are placed on the map with custom icons. - **Distance Calculation and Display**: The code uses the Google Maps Directions Service to calculate the route between the main marker and a selected fixed pin. The calculated route is rendered on the map, and an InfoWindow displays the distance in kilometers and duration in minutes. - **Map Interactions**: Users can click on the fixed pins to calculate and display the route between the main marker and the clicked pin. Clicking on the map away from any fixed pin or the main marker will clear the current route and recenter the map. - **Customizations**: The InfoWindow appearance is customized with specific background colors and styles. ## Usage 1. Clone the repository or download the HTML file. 2. Open the HTML file in a web browser. 3. The interactive map will load, displaying the main marker and fixed pins. 4. Click on any of the fixed pins to calculate and display the route to the main marker, along with the distance and duration information. 5. Click on the map away from any fixed pin or the main marker to clear the current route and recenter the map. ## Prerequisites This code relies on the Google Maps JavaScript API and requires an API key to function correctly. You'll need to replace the existing API key in the script source URL with your own valid API key. ```html <script src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&callback=initMap&libraries=places,geometry" async defer></script>
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.