Конечно не правильно,
| Код | <script src="http://maps.google.com/maps?file=api&v=2.x&hl=ru&oe=windows-1251&key=ABQIAAAA4JgkSUWxvX4OYjKFbYXrjxR75DXKV3ihZIKghfAcLR5jQOmywBS2Fx3xLxxxhGyrUfK_87xnHv7_Vw" type="text/javascript"></script> <script type="text/javascript"> var map; var geocoder; var bounds = new GLatLngBounds();
function initialize() { map = new GMap2(document.getElementById("map_canvas")); map.setCenter(new GLatLng(34, 0), 1); geocoder = new GClientGeocoder(); geocoder.getLocations('<? echo $dat[ulica]; if($dat[dom]) { echo ", д.".$dat[dom];} if($dat[korpus]) { echo ", к.".$dat[korpus];}if($dat[litera]){echo "литера".$dat[litera];}?> ', addAddressToMap); }
// addAddressToMap() is called when the geocoder returns an // answer. It adds a marker to the map with an open info window // showing the nicely formatted version of the address and the country code. function addAddressToMap(response) { map.clearOverlays(); if (!response){ // alert("Пустой ответ"); } else if (response.Status.code != 200) { // alert("Статус ответа: " + response.Status.code); } else { place = response.Placemark[0]; point = new GLatLng(place.Point.coordinates[1], place.Point.coordinates[0]); zoom = Math.round(place.AddressDetails.Accuracy/9*20); map.setCenter(point, zoom); // bounds.extend(point); //alert(map.getBoundsZoomLevel(bounds)); // map.setZoom(map.getBoundsZoomLevel(bounds)); // map.setCenter(bounds.getCenter()); marker = new GMarker(point); map.addOverlay(marker); marker.openInfoWindowHtml(place.address);
// showLocation() is called when you click on the Search button // in the form. It geocodes the address entered into the form // and adds a marker to the map at that location. }}
</script>
|
|