Google
Developer
Day2007
Maps API — Old Tricks and New Dogs
Steffen Meschkat
Copyright 2007 Google, Inc.

Why Maps

The Google Maps API

The API at a Glance

The API at a Glance

Code

<html>
  <head>
    <script src="http://maps.google.com/?file=api"></script>
  </head>
  <body onload="hello()" onunload="GUnload()">
    <div id="map" style="width:400px;height:300px"></div>
    <script>
      function hello() {
        var map = new GMap2(document.getElementById("map"));
        var point = new GLatLng(37.71859, 6.679688);
        map.setCenter(point, 2); 

        var marker = new GMarker(point);
        map.addOverlay(marker); 
        marker.openInfoWindowHtml("Hello World!"); 
      }
    </script>
  </body>
</html>

Marker Geometry FAQ

Asynchronous Continuation

How Services communicate to the maps Server

Closures and Memory Leaks

Performance

Extension Interfaces

The Google Maps API

Today: Finding an Apartment

Go to a real estate web site:
How safe is the area?
Where are good schools?

Therefore: Mapplets!

Mapplets are created from a mashup of APIs

Code

<?xml version="1.0" encoding="UTF-8"?>
<Module>
<ModulePrefs>
  <Require feature="sharedmap"/>
</ModulePrefs>
<Content type="html"><![CDATA[

<h2>Hello World!</h2>

<script> 
  var map = new GMap2();
  var point = new GLatLng(37.71859, 6.679688);
  map.setCenter(point, 2); 

  var marker = new GMarker(point);
  map.addOverlay(marker); 
  marker.openInfoWindowHtml("Hello World!"); 
</script>

]]></Content>
</Module>

High Level Architecture

How a Mapplet Communicates With Google Maps

Maps vs. Mapplets API: Asynchronous Calls

Separation of Code and Data

KML Example

<?xml version="1.0" ?>
<kml xmlns="http://earth.google.com/kml/2.1">
  <Document>

    <Placemark>
      <name> Stanford University </name>
      <Point>
        <coordinates> -122.161851,37.425022,0 </coordinates>
      </Point>
    </Placemark>

    <Placemark>
      <name> Googleplex </name>
      <Point>
        <coordinates> -122.084681,37.421901,0 </coordinates>
      </Point>
    </Placemark>

  </Document>
</kml>

Conclusion

Controls: Pan & zoom, Zoom, Map type, Scale, Overview.
Hello World. (Clear.)
Marker Geometry:
Bubble, Pin. (Clear.)
Geocoding: 
Directions: 
Run, Done, Clear.