Google map is cool!

A while ago I have discovered Google Map API. After playing a while I have created a service for my local community: http://mapa.lomianki.org. It’s so easy and fun to create maps that, virtually anyone can add one to their site, pointing to this or that place 🙂 .

Here’s a quick tutorial.

  1. Get Google Map API key.
  2. Create a HTML page with a div object, that will contain your map, you can paste example given by while signing for API key.
  3. Replace load javascript with:
        function load() {
          if (GBrowserIsCompatible()) {
            var map = new GMap2(document.getElementById("map"));
            map.addControl(new GLargeMapControl());
            map.addControl(new GMapTypeControl());
            var point = new GLatLng(52.34194676040349, 20.89900016784668);
    //        map.setCenter(point, 14, G_HYBRID_MAP);
            map.setCenter(point, 13, G_NORMAL_MAP);
            var marker = new GMarker(point);
            map.addOverlay(marker);
            GEvent.addListener(marker, "click", function() {
              marker.openInfoWindowHtml("Here I am :)");
            });
          }
        }
  4. Replace coordinates of „point” to your desired start destination, you can get precise coordinates from my map, by moving a marker to desired place.
  5. It work’s!

Other tutorials and apis.

Dodaj komentarz