Hacking Google Maps and Google Earth (ExtremeTech)

(Dana P.) #1

Chapter 7 — Extending the Google API Examples 129


</script>
</head>
<body onload=”onLoad()”>

<div id=”map” style=”width: 800px; height: 600px”>







The application works by adding a listener to the map. Each time the user clicks on the map,
the latitude and longitude will be displayed in the message area of the display (identified by the


tag immediately after the map). The embedded function that is called each time the
map is clicked just updates the HTML content of the message area.

Now you can click on the map and get a precise value to locate your position when creating
markers. See Figure 7-14 for an example.


FIGURE7-14: Finding your latitude and longitude in a map.

Free download pdf