3 Replies - 3576 Views - Last Post: 27 October 2012 - 08:15 PM

#1 hondakillrsx  Icon User is offline

  • New D.I.C Head

Reputation: -2
  • View blog
  • Posts: 29
  • Joined: 08-March 12

Reverse Geocoding with Google Maps

Posted 25 October 2012 - 07:11 PM

Hey guys,
Super new to anything coding so this should be an easy one for someone with any experience. I'm trying to create a Google map that you can double click to create a marker, then when you click on the marker it opens an infowindow that has the latLng reverse Geocoded with the street address. This is what I have so far:
  google.maps.event.addListener(map, "dblclick", function(event) {
        marker = new google.maps.Marker({
          position: event.latLng,
          map: map
        });
 
  google.maps.event.addListener(marker, "click", function() {
		  var latlng = new google.maps.Marker.latLng;
		  codeLatLng();
		  infowindowtest.open(return????);
        });
    });



  function codeLatLng() {
    var input = document.getElementById("latlng").value;
    var latlngStr = input.split(",",2);
    var lat = parseFloat(latlngStr[0]);
    var lng = parseFloat(latlngStr[1]);
    var latlng = new google.maps.LatLng(lat, lng);
    geocoder.geocode({'latLng': latlng}, function(results, status) {
      if (status == google.maps.GeocoderStatus.OK) {
        if (results[1]) {
          map.setZoom(11);
          marker = new google.maps.Marker({
              position: latlng,
              map: map
          });
          return(results[1].formatted_address);
        }
      } else {
        alert("Geocoder failed due to: " + status);
      }
    });
  } 



I've got the double click to create the marker, then I want to single click the marker, run the geocoding function, return the 1st result and then send it back to the infowindowtest where it can be displayed. Let me know if you can point me in the right direction.

Is This A Good Question/Topic? 0
  • +

Replies To: Reverse Geocoding with Google Maps

#2 hondakillrsx  Icon User is offline

  • New D.I.C Head

Reputation: -2
  • View blog
  • Posts: 29
  • Joined: 08-March 12

Re: Reverse Geocoding with Google Maps

Posted 26 October 2012 - 12:44 PM

Anyone???? I'm really stuck here..
Was This Post Helpful? 0
  • +
  • -

#3 GetSet  Icon User is offline

  • D.I.C Head

Reputation: 5
  • View blog
  • Posts: 116
  • Joined: 08-February 11

Re: Reverse Geocoding with Google Maps

Posted 26 October 2012 - 04:18 PM

Did you find any examples of what you are looking for across the web?

I often inline clients' business locations via Google Maps. I am curious to post as I am now wondering if your goal here could be of useful purposes.

What exactly, I am asking, are you trying to achieve?
Was This Post Helpful? 0
  • +
  • -

#4 hondakillrsx  Icon User is offline

  • New D.I.C Head

Reputation: -2
  • View blog
  • Posts: 29
  • Joined: 08-March 12

Re: Reverse Geocoding with Google Maps

Posted 27 October 2012 - 08:15 PM

I'm trying to create a marker which opens the infowindow. on that inforWindow I need a textbox that has the reverse geocode of the marker already put in the textbox.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1