Crono Semidio


Registrato: 24/03/05 15:12 Messaggi: 224 Residenza: Trieste
|
Inviato: 27 Giu 2007 12:56 Oggetto: Google Maps e ricerca indirizzi |
|
|
Utilizzando le Google Maps API devo costruire una mappa che includa alcune semplici funzioni, finora quello che sono riuscito a produrre è questo:
Codice: | <!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" xmlns:v="urn:schemas-microsoft-com:vml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title>Google Maps JavaScript API Example</title>
<style type="text/css">
v\:* {
behavior:url(#default#VML);
}
</style>
<script src="http://maps.google.com/maps?file=api&&v=2.x&key=ABQIAAAAtOjLpIVcO8im8KJFR8pcMhQjskl1-YgiA_BGX2yRrf7htVrbmBTWZt39_v1rJ4xxwZZCEomegYBo1w"
type="text/javascript"></script>
<script type="text/javascript">
//<![CDATA[
var map = null;
var geocoder = null;
function load() {
if (GBrowserIsCompatible()) {
map = new GMap2(document.getElementById("map"));
map.addControl(new GLargeMapControl());
map.addControl(new GMapTypeControl());
map.addControl(new GOverviewMapControl());
map.addControl(new GScaleControl());
map.setCenter(new GLatLng(41.899344, 12.493110), 16);
map.enableDoubleClickZoom();
map.enableScrollWheelZoom();
geocoder = new GClientGeocoder();
window.setTimeout(setupOfficeMarkers, 0);
}
}
function showAddress(address) {
if (geocoder) {
geocoder.getLatLng(
address,
function(point) {
if (!point) {
alert(address + " not found");
} else {
map.setCenter(point, 13);
var marker = new GMarker(point);
map.addOverlay(marker);
marker.openInfoWindowHtml(address);
}
}
);
}
}
//]]>
</script>
</head>
<meta content="MSHTML 6.00.6000.16481" name=GENERATOR>
<body onload="load()" onunload="GUnload()">
<form action="#" onsubmit="showAddress(this.address.value); return false">
<p>
<input type="text" size="60" name="address" />
<input type="submit" value="Go!" />
</p>
<div id="map" style="width: 1000px; height: 800px"></div>
</form>
</body>
</html> |
il problema è che non funziona la ricerca degli indirizzi ma non riesco a capire perchè visto che ha funzionato perfettamente fino a quando non ho inserito i controlli ed abilitato gli zoom, ho il sospetto che il problema sia legato a questa linea di codice "geocoder = new GClientGeocoder();" nella funzione load() ma è la prima volta che uso le API di maps e non so come risolvere |
|