Saturday, March 6, 2010

Google Maps Api : Adresten haritaya

<!-- Açıklama yaz :) -->

 <script src="http://maps.google.com/maps?file=api&v=2&key=ApiKeyinizBurayaYazılacak&sensor=true"
        type="text/javascript"></script>
       
    <script type="text/javascript">
 var geocoder;
 var map; 
 function initialize() {
 var geocoder = new GClientGeocoder();
 var map = new GMap2(document.getElementById("map_canvas"));
   geocoder.getLocations("Ankara , TURKEY", function(result){
          if (result.Status.code != 200) {
            alert('Could not geocode "' + result.name + '"');
            return;
        }
          place = result.Placemark[0];
          point = new GLatLng(place.Point.coordinates[1],
                              place.Point.coordinates[0]);
          map.setMapType(G_HYBRID_MAP);
          map.setCenter(point, 8);
          marker = new GMarker(point);
         map.addOverlay(marker);
         alert("OK");
          marker.openInfoWindowHtml(place.address);
    
   });
 
 }
  
    $(document).ready(function(){
     initialize(); 
    });

    </script>


Konuyu irdeleyin:
geocoder.getLocations : 
 - http://www.google.com.tr/search?hl=tr&rlz=1C1GGLS_trTR355TR355&q=geocoder.getLocations&btnG=Ara&meta=&aq=f&oq=
http://www.developer.com/tech/article.php/3615681/Introducing-Googles-Geocoding-Service
google maps api ref. : 
http://code.google.com/apis/maps/documentation/reference.html

No comments: