Le mappe di google nel nostro sito web

Posted on 03. May, 2006 by Administrator in tutorials, vari


Se vogliamo mettere le mappe di google nel nostro sito web, dobbiamo innanzitutto andarare alla pagina

http://www.google.com/apis/maps/signup.html

Accettare le condizioni e inserire l'url del sito in cui andremmo a mettere le mappe. Fatto cio' ci verra' chiesto di
loggarci per ricevere la chiave di attivazione della mappa oppure di effetturare una nuova iscrizione.
Una volta ottenuta la chiave, che e' qualcosa del tipo:

ABDIAAAAwVU8SsGlrIG1WCJ_qdE4RhRw69XHqkM0S-xNHsFuHjX92yY685TbfzO88Mb9LMPYovkd_Znv_FDyAA

creiamo in nostro primo file di esempio:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script src="http://maps.google.com/maps?file=api&v=1&key=ABDIAAAAwVU8SsGlrIG1WCJ_qdE4RhRw69XHqkM0S-xNHsFuHjX92yY685TbfzO88Mb9LMPYovkd_Znv_FDyAA" type="text/javascript"></script>
</head>
<body>
<div id="map" style="width: 500px; height: 400px"></div>
<script type="text/javascript">
//<![CDATA[

var map = new GMap(document.getElementById("map"));
map.addControl(new GSmallMapControl());
map.centerAndZoom(new GPoint(-122.1419, 37.4419), 4);

//]]>
</script>
</body>
</html>

dove in

map.centerAndZoom(new GPoint(-122.1419, 37.4419), 4);

andremmo a specificare latitudine e longitudine

Vediamo il risultato:

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • blinkbits
  • BlinkList
  • blogmarks
  • co.mments
  • del.icio.us
  • De.lirio.us
  • digg
  • Fark
  • feedmelinks
  • Furl
  • LinkaGoGo
  • Ma.gnolia
  • NewsVine
  • Reddit
  • scuttle
  • Smarking
  • Spurl
  • YahooMyWeb
  • DZone
  • Internetmedia
  • Snap2r
  • Technorati

Leave a reply