This is my home, also referred to as Where the cool people live','';
Let’s break it down, My Home This creates a Heading with the words “My Home”. ''+ '
This is my home This piece starts the body section and it puts in bold the words “This is my home”. ''
Finally, this section will add the image you selected at the beginning of this section using S RC=”your_link”. N ote: you can change the image size by playing with the width="70%" section.
marker being dropped in a bakery.
You have successfully created the information that will be shown int the infoWindow. Now the infoWindow function will be defined as follows: var infowindow = new
google.maps.InfoWindow({ content: contentString });
Finally you would want to be able to click the marker and show the infoWindow right? Then add the following code: marker.addListener('click', function() { infowindow.open(map, my_marker);
Display your own location To finish this guide we will show you how to automatically add a marker to your location. First look up online some marker icons, we recomemend using https://www.iconfinder.com/search/?q=ma rker&price=free And save the icon to your directory. Next add this piece of code to your own:
});
var image = 'images/mylocationmarker.jpg'; Now test it out, you should be able to see the marker you added and when you click it should “popup” the infoWindow with the information you wrote along with the image, here is an example from our work, the
navigator.geolocation.getCurrentPosition(fu nction(position) { var pos = { lat: position.coords.latitude, lng: position.coords.longitude } v ar locationMarker = new google.maps.Marker({ position: pos,
map: map, icon: image, animation: google.maps.Animation.DROP }); Let's break down!, var image = 'images/mylocationmarker.jpg'; This will create a variable containing the custom marker location. navigator.geolocation.getCurrentPosition(fu nction(position) { var pos = { lat: position.coords.latitude, lng: position.coords.longitude } This section will start the geolocation function and will save your Lat and Lng to their respective variables. var locationMarker = new google.maps.Marker({ position: pos, map: map, icon: image, animation: google.maps.Animation.DROP }); Finally the marker is created, with p osition as your location, map as your initialized map, i con b eing the custom marker image and finally animation i s just an effect to see when the custom marker is loaded. And THAT’S IT! Congratulations you have now created your first Google Map map, with custom marker locations, info WIndows and even user location.
Conclusion Google Maps is by far one of the best tools for business, it's simple to understand, it’s clean and informative and it presents the user a simple view of information relating to the location. Google Maps API is cross-platform, we chose to start off with the Javascript implementation as a recommendation from our mentor, Ana Carmen Gonzalez, and it gave us a faster and easier way of understanding the API, our hopes is that we could continue with the other implementations as well, but in the case that we cannot this guide will serve as the base for the following students or anyone wanting to learn about Google Maps. This was by far one of the most interesting and fun experiences we have had in our coursework. The whole concept and the ease of use of Google Maps API made this experience truly unique. We also hope that we have presented this material as simple and as clearly as possible.