Lesson goal: Make a Google Map

Previous: Functions make it easier | Home | Next: Place a marker

Everyone has seen Google's fine online maps. What's neat about their map service is that they allow programmers (like you) to "tap into" their map system to create your own programs that can drive the maps. This lesson will allow you to use your programming skills to create a map application.

If you really "get into" maps, you'll find they have strong connections to math. The lesson here is to get you started, by allowing you to familiarize yourself with what longitude and latitude mean (hint: they are like $x$ and $y$ coordinates you are used to using on the Cartesian Coordinate System).

If you are confused about what latitude and longitude to start with, use 0,0 like this drawmap(0,0,5), then click on the map that comes up. The (latitude,longitude) of your click will be displayed in the output window. You can use these click numbers to more closely customize your map location.

drawmap(latitude,longitude,zoom)

Maps will always appear at the very bottom of this browser window, under your code editor. You might have to scroll down to see it.

Now you try. Fill the latitude and longitude of the city you live in, to create a map centered there!

This code will not run! You have to fill in the initial latitude and longitude about which to center the map. Dismiss.
Show a friend, family member, or teacher what you've done!