Hacking Google Maps and Google Earth (ExtremeTech)

(Dana P.) #1

114 Part II — Instant Gratification


FIGURE7-6: Adding multiple markers.

Listing 7-6:Creating Markers during Startup

<script type=”text/javascript”>
//<![CDATA[

var map;

function onLoad() {
// The basics.
//
// Creates a map and centers it on Palo Alto.
if (GBrowserIsCompatible()) {
map = new GMap(document.getElementById(“map”));
map.centerAndZoom(new GPoint(-0.64,52.909444), 3);
addmarker(-0.6394,52.9114);
addmarker(-0.64,52.909444);
addmarker(-0.6376,52.9073);
}
}

function addmarker(x,y) {
Free download pdf