Temadown Wptr | Theme by mg12 | Valid XHTML 1.1 and CSS 3
  • Google map ile koordinat ve adres bilgisi alma

    Asagidaki ornekte google map uzerinden adres ve koordinat bilgisi alma bulunuyor bir gun bir yerde isinize yarayabilir :)

      <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
      <html>
      <head>
      <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
      <title>SBM Map</title>
      <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;sensor=false&amp;key=ABQIAAAAzr2EBOXUKnm_jVnk0OJI7xSosDVG8KKPE1-m51RBrvYughuyMxQ-i1QfUnH94QxWIa6N4U6MouMmBA"
                  type="text/javascript"></script>
          <script type="text/javascript">
       
          var map;
          var geocoder;
          var address;
       
          function initialize() {
            map = new GMap2(document.getElementById("map_canvas"));
            map.setCenter(new GLatLng(41.091255,29.002876), 13);
            map.setUIToDefault();
            GEvent.addListener(map, "click", getAddress);
             
            geocoder = new GClientGeocoder();
          }
         
          function getAddress(overlay, latlng) {
            if (latlng != null) {
              address = latlng;
              geocoder.getLocations(latlng, showAddress);
            }
          }
       
          function showAddress(response) {
            map.clearOverlays();
            if (!response || response.Status.code != 200) {
              alert("Status Code:" + response.Status.code);
            } else {
              place = response.Placemark[0];
              point = new GLatLng(place.Point.coordinates[1],
                                  place.Point.coordinates[0]);
              marker = new GMarker(point);
              map.addOverlay(marker);
              marker.openInfoWindowHtml(
              '<b>orig latlng:</b>' + response.name + '<br/>' +
              '<b>latlng:</b> ' + place.Point.coordinates[1] + "," + place.Point.coordinates[0] + '<br>' +
              '<b>Status Code:</b>  ' + response.Status.code + '<br>' +
              '<b>Status Request:</b> ' + response.Status.request + '<br>' +
              '<b>Address:</b>' + place.address + '<br>' +
              '<b>Accuracy:</b>' + place.AddressDetails.Accuracy + '<br>' +
              '<b>Country code:</b> ' + place.AddressDetails.Country.CountryNameCode);
              document.getElementById('lat').value=place.Point.coordinates[1];
              document.getElementById('lng').value=place.Point.coordinates[0];
              document.getElementById('address').value=place.address;
            }
          }
       
       
          </script>
       
       
      </head>
      <body onload="initialize()" onunload="GUnload()">
        <div id="map_canvas" style="width: 500px; height: 300px"/>
        <form>
         <table>
          <tr>
           <td>Lat :</td>
           <td><input type="text" name="lat" id="lat"/> </td>
        </tr>
        <tr>
           <td>Lng :</td>
           <td><input type="text" name="lng" id="lng"/> </td>
        </tr>
        <tr>
           <td>Adres :</td>
           <td><textarea name="address" id="address" cols="40" rows="4"></textarea> </td>
        </tr>
         </table>
        </form>
      </body>
       
      </html>
    • del.icio.us
    • Facebook
    • Google
    • Digg
    • Mixx
    • Technorati
    • Live
    • Reddit
    • Sphinn
    • Furl
    Salı, Haziran 2nd, 2009 at 14:30
  • Çarşamba, Haziran 9th, 2010 at 10:36 | #1

    eline sağlık çok güzel olmuş…

Leave a comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>
TOP