Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7190921
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T19:37:10+00:00 2026-05-28T19:37:10+00:00

I need to use Google Maps (v3) to check whether an address typed into

  • 0

I need to use Google Maps (v3) to check whether an address typed into a search field actually exists and print it out on the screen. That’s easy enough to do just by checking whether a latitude/longitude pair is found for that address. However, I have a problem.

When a user types in a broad search, such as a common street name like First Street, I need to print out all the results found so the user can choose one. I do not need to display the results on the map at this point, just show a list of them on the page. I found some code online that is supposed to do just that and I modified it but it doesn’t work. I get a ‘GClientGeocoder() is not defined’ error, but I suspect that even when I get past that the code will have problems so I was wondering if someone with more experience could point me in the right direction.

Here’s the code, I hardcoded the search term ‘First Street’ into the function for testing purposes.

function showAddress() {
    var geo;
    geo = new GClientGeocoder();
    var search = 'First Street';
    // ====== Perform the Geocoding ======        
    geo.getLocations(search, function (result)
      {
        //map.clearOverlays(); 
        if (result.Status.code == G_GEO_SUCCESS) {
          // ===== If there was more than one result, "ask did you mean" on them all =====
          if (result.Placemark.length > 1) { 
            document.getElementById("message").innerHTML = "Did you mean:";
            // Loop through the results
            for (var i=0; i<result.Placemark.length; i++) {
              document.getElementById("message").innerHTML += "<br>"+(i+1)+": "+result.Placemark[i].address;
            }
          }
          // ===== If there was a single marker =====
          else {
            document.getElementById("message").innerHTML = "Result found:"+result.Placemark[0].address;
          }
        }
        // ====== Decode the error status ======
        else {
          alert('No results found');
        }
      }
    );
  }

“Message” is just a regular <div>. The function is called from the body tag:

<body onLoad='showAddress()'>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T19:37:11+00:00Added an answer on May 28, 2026 at 7:37 pm

    This code is created for the outdated V2-API, I guess you are loading the V3-API-scripts.

    When I run it with the V2-API it works fine.

    V2 and V3 are not compatible in any way.

    Code translated to V3:

        function showAddress() {
          var geo = new google.maps.Geocoder();
    
          var address = 'First Street';
          geo.geocode({"address": address},
                          function(result,status)
                          {
                            var out='no results found';
                            if (status == google.maps.GeocoderStatus.OK) 
                            {
                              if(result.length==1)
                              {
                                out = "Result found:"+result[0].formatted_address;
                              }
                              else
                              {
                                out = "Did you mean:";
                                for(var i=0;i<result.length;++i)
                                {
                                  out+="<br>"+(i+1)+": "+result[i].formatted_address;
                                }
                              }
    
                            }
    
                            document.getElementById("message").innerHTML = out;
                          }
                        );
      }
    

    http://jsfiddle.net/doktormolle/xUHAR/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What do I need to use to get a search listing using the google
I'm curious whether it's possible to use Google Maps Street View as a platform
I am building an application using google maps. And i need to use google
I'm trying to use Google Maps API and i'm stuck here: I need an
Programming an iPhone App, I need to use Google Maps api to get directions
I need to use Google Maps within a Facebook page (as a new tab).
To use the Google Maps API, I need to generate a debug API key.
I need something like Google-maps, usable on a commercial project. Can I use GoogleMaps?
In my project I need to use the Google Maps API to place users
I need an up to date and easy to use .net wrapper for google

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.