Google Geocoder

Posted on 2012-08-31
Medium Priority
Last Modified: 2012-09-01
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

Question by:grantballantyne
  • 2
LVL 83

Expert Comment

ID: 38356564
LVL 25

Accepted Solution

lwadwell earned 2000 total points
ID: 38356596
Example attached.

Author Comment

ID: 38357693
Thanks lwadwell

Thats is almost exactly what I need.

Please see the following :  http://dev.blackwoodsmith.com/cms/addproperty3.asp

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

Many thanks

Author Comment

ID: 38357734

Thanks again.

Please ignore previous question - I managed to work it out.

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
This article was originally published on Monitis Blog, you can check it here . Today it’s fairly well known that high-performing websites and applications bring in more visitors, higher SEO, and ultimately more sales. By the same token, downtime…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses
Course of the Month16 days, 6 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question