Create an html file that has the Google maps Javascript API embedded in it. You
ID: 670182 • Letter: C
Question
Create an html file that has the Google maps Javascript API embedded in it. You will need to register for an API key with your Google account. Don’t restrict the API key to certain referrers or the grader will not be able to run your code (although you would want to if you did this on a real website). Don’t just copy one of the examples – modify them to contain multiple data points. Get creative and connect them with a route or include extra data in an infowindow from an array (that could be populated from a database)… do something interesting with the data.
Submit this single html file to Blackboard by the deadline. This file should work by saving it to a local machine and opening it in a browser (File->open)
Explanation / Answer
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<style type="text/css">
html { height: 100% }
body { height: 100%; margin: 0px; padding: 0px }
#map_canvas { height: 100% }
</style>
<script type="text/javascript"
src="http://maps.google.com/maps/api/js?sensor=set_to_true_or_false">
</script>
<script type="text/javascript">
function initialize() {
var latlng = new google.maps.LatLng(23.219104, 72.657137);
var myOptions = {
zoom: 8,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("map_canvas"),
myOptions);
}
</script>
</head>
<body>
<div id="map_canvas"></div>
</body>
</html>
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.