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

  • Home
  • SEARCH
  • 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 416385
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T18:28:31+00:00 2026-05-12T18:28:31+00:00

I am using Google Maps API for reverse lookup of an address, specifically Country,

  • 0

I am using Google Maps API for reverse lookup of an address, specifically Country, City and ZIP code. The problem I have is that with geocoder when you input a specific lat lng you get a range of results based on the address detail accuracy. For example if you click on the street you get address detail accuracy of 8 and the address looks like this; “street, city, country code” or “street, city zip code, country code”. And if you click on another location you can get address detail accuracy of 5 which returns; city zip code, country code.

All I am looking for is the the city, zip code and country. Is there any way to force Google maps to return address detail accuracy of 5 all the time or to return the elements broken up into individual parts i.e. city, zip code and country.

This is the code I am using to get the information:

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml"> 
  <head> 
    <meta http-equiv="content-type" content="text/html; charset=UTF-8"/> 
    <title>Google Maps JavaScript API Example:  Reverse Geocoder</title> 
    <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAAMkjr3Dq_jK6GSFYDFzaHTBRoJ0TBOI_XK4bTNi9dL2l04KlxphRNL_k0peOib9IHF6T2KwlVmOb6uQ" type="text/javascript"></script> 
    <script type="text/javascript">

        var map;
        var geocoder;
        var address;

        function initialize() {

            var zoom = 10;

            map = new GMap2(document.getElementById("map_canvas"));
            map.setCenter(new GLatLng(40.730885, -73.997383), zoom);
            map.setUIToDefault();
            GEvent.addListener(map, "click", getAddress);
            geocoder = new GClientGeocoder();
        }

        function getAddress(overlay, latlng) {
            if (latlng != null) {
                address = latlng;
                geocoder.getLocations(latlng, showAddress);
            }
        }

        function showAddress(response) {
            map.clearOverlays();
            if (!response || response.Status.code != 200) {
                alert("Status Code:" + response.Status.code);
            } else {
                place = response.Placemark[0];
                point = new GLatLng(place.Point.coordinates[1], place.Point.coordinates[0]);
                marker = new GMarker(point);
                map.addOverlay(marker);

                var message = '<b>orig latlng:</b>' + response.name + '<br/>' +
                                '<b>latlng:</b>' + place.Point.coordinates[1] + "," + place.Point.coordinates[0] + '<br>' +
                                '<b>Status Code:</b>' + response.Status.code + '<br>' +
                                '<b>Status Request:</b>' + response.Status.request + '<br>' +
                                '<b>Address:</b>' + place.address + '<br>' +
                                '<b>Accuracy:</b>' + place.AddressDetails.Accuracy + '<br>' +
                                '<b>Country code:</b> ' + place.AddressDetails.Country.CountryNameCode;

                marker.openInfoWindowHtml(message);
            }
        }


    </script> 
  </head> 

  <body onload="initialize()"> 
    <div id="map_canvas" style="width: 800px; height: 600px"></div> 
  </body> 
</html>

Any help would be greatly appreciated. My last resort would be to parse the address string but it feels like an overkill. There must be a cleaner way.

I am currently looking at the getLocations() method maybe parsing the JSON result could yield the fields I am looking for.

Thanx.

  • 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-12T18:28:31+00:00Added an answer on May 12, 2026 at 6:28 pm

    You’ll need to handle differing accuracy levels in your app…the API can’t do everything for you ;). I agree that it would be nice if you could dictate to the geocoder which accuracy level you’d like, it’s just not there at this point. Maybe google will implement it in the future but, until then, you’ll have to parse the results in your app. This post has a breakdown of the different accuracy values: Picking the most accurate geocode

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

Sidebar

Related Questions

I am currently using the google maps' reverse geocoding API to convert long/lat received
It seems that licensing terms would prevent us from using Google Maps API in
I've been using Google Maps Api for a while and I recently checked that
I am using google maps api v3 and have an array of arrays object:
I am using Google maps JavaScript API. Here is code : <!DOCTYPE html PUBLIC
I'm using google maps API 3 and a custom overlay (OverlayView) I have this
We are using Google maps API V3 and we have a set of boundries
I am using Google Maps V3 API and using its Geocoder to do reverse
I am using google maps Api V3 and using reverse geocoding to find the
I'm using the Google Maps Javascript API V3 to reverse-geocode a lot of locations

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.