Help convert google maps 2 to 3?

Discussion in 'JavaScript' started by EricBruggema, Mar 18, 2013.

  1. #1
    Hi there,

    Is there anyone that can convert this working function (for google maps v2) to a v3 version?
    var geocoder = new GClientGeocoder();
    geocoder.getLatLng(this.value, function (point) {
    if (point) {
    map.setCenter(point, 8, G_PHYSICAL_MAP);
    }
    });
    Code (markup):
     
    EricBruggema, Mar 18, 2013 IP
  2. EricBruggema

    EricBruggema Well-Known Member

    Messages:
    1,740
    Likes Received:
    28
    Best Answers:
    13
    Trophy Points:
    175
    #2
    I have the sollution and here to share it with you all.

    var geocoder, map;
     
    function codeAddress(address) {
        geocoder = new google.maps.Geocoder();
        geocoder.geocode( { 'address': address + ', the netherlands'}, function(results, status) {
          if (status == google.maps.GeocoderStatus.OK) {
            map.setCenter(results[0].geometry.location);
          }
        });
      }
    Code (markup):
     
    EricBruggema, Mar 18, 2013 IP