Lesson goal: Make a Google Map

Previous: Take a derivative | 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)
Move the mouse over a dotted box for more information.

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!

Type your code here:


See your results here:

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!

Here is a share link to your code:

Does your code work? Want to run it on your iPhone?

Here's your code:

  1. Use [Control]-[C] (Windows) or [⌘]-[C] (MacOS) to copy your code.

  2. Paste it using [Control]-[V] (Windows) or [⌘]-[V] (MacOS) into this page

  3. Then click the "Use on iPhone" button that you'll see.