Google map / jquery reverse geocoding

I have a google map that takes and puts coordinates from input fields.

Everything works fine - but now I want to try and add the ability to search by address to it - (address lookup) and I can't get it to work ...

Fiddle here: http://jsfiddle.net/obmerk99/rcTUH/

Any insight will be greatly appreciated. (and be gentle - I'm not a JS ninja :-))

+3


source to share


3 answers


Needs a bit of cleanup, but this is basic JavaScript. I think it has what you are looking for.



http://files.nyu.edu/hc742/public/googlemaps/geocoding.html

+1


source


@charlietfl was correct. Sometimes the violin onLoad

makes a mess of all things. My answer



+1


source


You had two small problems that could be easily spotted in the browser debug console

 /* geocoder was undefined ..add following*/
 var geocoder= new google.maps.Geocoder();

   /* exixting code*/
  map = new google.maps.Map($('#map')[0], myOptions);
  placeMarker(myLatlng);

  /* changed variable in argument from "latLng" to "myLatLng"*/
  GeoCode(myLatlng);

      

Working demo: http://jsfiddle.net/rcTUH/6/

0


source







All Articles