Google Geocoder

Dear Experts

I am using the code below to plot a google map.  As you will see I am using the lat and long values which I have in this instance.

'function initialize()
      // Make an instance of Geocoder
      geocoder = new google.maps.Geocoder();
      // Set static latitude, longitude value
var latlng = new google.maps.LatLng(<%=(residential.Fields.Item("pLat").Value)%>, -<%=(residential.Fields.Item("pLong").Value)%>);

      // Set map options
      var myOptions = {
            zoom: 17,
            center: latlng,
            panControl: true,
            zoomControl: true,
            scaleControl: true,
            mapTypeId: google.maps.MapTypeId.ROADMAP
      // Create map object with options
      map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
      // Create and set the marker
      marker = new google.maps.Marker({
            map: map,
            position: latlng
      // Register Custom "dragend" Event
      google.maps.event.addListener(marker, 'dragend', function() {
            // Get the Current position, where the pointer was dropped
            var point = marker.getPosition();
            // Center the map at given point
            // Update the textbox
            document.getElementById('txt_lng').value=point.lng()* -1;

I am trying to achieve the same except this time I do not have the lat and long values but only the postcode.

Can anyone suggest what changes I need to the above to geocode the postcode and give me the same output.

Many thnaks for any help

Who is Participating?
lwadwellConnect With a Mentor Commented:
Example attached.
grantballantyneAuthor Commented:
Thanks lwadwell

Thats is almost exactly what I need.

Please see the following :

Do you know how I can make the values appear in the form boxes?

Many thanks
grantballantyneAuthor Commented:

Thanks again.

Please ignore previous question - I managed to work it out.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.