Showing posts with label Google API. Show all posts
Showing posts with label Google API. Show all posts

Sunday, March 11, 2007

Google Map API: Changing location

Finally done something on Google MAP on the right side of the blog. Mine is no longer point to Googleplex. If your Goolge MAP is pointing to same location as the example they gave you, here is how to change the location.

Go to maps.google.com/maps. Adjust map until you get the view you want. Remember embedded map is smaller than Google Map. Click on "Link to this page". If you check the URL, you will see two entry separated by "&"

... &z=11&ll=37.062848,-95.76982& ...

ll is the parameter for GLatLng and z goes to the last parameter of map.setCenter. So I finally change the

map.setCenter(new GLatLng(37.4419, -122.1419), 13);

to

map.setCenter(new GLatLng(39.726729, -104.924927), 11);

Friday, January 12, 2007

Playing with Google Map API

Once I signed up for a Google Map API key, I got an example of HTML/Javascript code for adding Google map on a webpage. Only problem was that it was using "onload" function in HTML body tag. It is easy to add a Javascript code in blogger by editing template but I didn't want to mess it up.

I finally figure out how to add function to onload event. I'm getting used to writing a Javascript now.

    <body onload="load()" onuload="GUnload()">
replace it with
    window.onload=load;
window.onunload=GUnload;