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 1011919
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T09:51:57+00:00 2026-05-16T09:51:57+00:00

I created a function to take location input, pass it to Google Maps Javascript

  • 0

I created a function to take location input, pass it to Google Maps Javascript API V2, and return a latitude/longitude/normalized address that I’ll have to split into different fields in a database (i.e. city, state, postal). I’m requiring at least a level 5/post code accuracy for the input so that the returned data from Google will always have…

  • Country
  • City (Locality)
  • State (Administrative Area)
  • Postal
  • Lat/Long

Here’s some info on the JSON object structure that Google returns.
http://code.google.com/apis/maps/documentation/javascript/v2/services.html#Geocoding_Structured

Problem: For some instances, Placemark.AddressDetails will not include a postal code, while the summarized Placemark.address will include the postal code.

For example, the following input examples will return a postal code inside Placemark.address, but not Placemark.AddressDetails;

  • 10437 Innovation Drive, Milwaukee, WI 53226
  • MOMA
  • Empire State Building –> this actually returns the postal code inside of some weird “DependentLocality” under SubAdministrativeArea.Locality

Here’s my troubleshooting code:

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<!-- You must insert your maps API script here. -->
<script language="javascript" type="text/javascript" src="http://www.json.org/json2.js"></script>

<script type="text/javascript"> 
    $(document).ready(function()
    {
        var geocoder = new GClientGeocoder();

        $.geolocateAddress = function(address)
        {  
            geocoder.getLocations(address, function(response)
            {
                if (response != null && response.Placemark != undefined)
                {

                    var placemark = response.Placemark[0];
                    // Placemark has Post code or higher accuracy -> http://code.google.com/apis/maps/documentation/javascript/v2/reference.html#GGeoAddressAccuracy
                    if (placemark.AddressDetails.Accuracy >= 5)
                    {
                        alert(placemark.address);
                        try {
                            alert(placemark.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea.Locality.PostalCode.PostalCodeNumber);
                        } catch (err) {
                            alert('What the deuce?  Why is there no postal code?... I bet you the placemark.address has the postal code.');
                            alert(JSON.stringify(placemark));
                        }
                    } else {
                        alert('Sorry, this requires at least a postal code input for accuracy')
                    }
                } else {
                    alert('Failed to geo locate address');
                }
            });
        };

        $("#location").blur(function(event)
        {
            var address = $("#location").val();
            $.geolocateAddress(address);
        });

    });
</script>

<form action="" method="get"> 
    <input title="Location" type="text" value="" id="location" /> 
</form>

Phew… Is there something I’m just not understanding about schema of Google Maps placemarks? Would I be able to solve this problem by upgrading to Google Maps Javascript API V3? (V2 JSON objects seems more intuitive IMO)
http://code.google.com/apis/maps/documentation/javascript/services.html

I’m about to throw in the towel on this. Hopefully somebody can help!

  • 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-16T09:51:57+00:00Added an answer on May 16, 2026 at 9:51 am

    This has been a problem ever since the geocoding service existed.

    For a bit of background, see the “bug report/feature request” I posted to the issue tracker in 2008:

    http://code.google.com/p/gmaps-api-issues/issues/detail?id=606

    In that thread, Pamela Fox and Thor Mitchell are Google employees who were part of the Maps team at the time.

    A year and a half later, Google responded with some improvements:

    https://groups.google.com/group/google-maps-api/browse_thread/thread/4d0ade19dadcda4f#

    and things improved a lot, but geocoding is not an exact science.

    In any case, you might be using an old version of the geocoder because I get a postal code with this request:

    http://maps.google.com/maps/api/geocode/xml?sensor=false&address=10437%20Innovation%20Drive,%20Milwaukee,%20WI

    That’s a direct http request, but the API V3 should be returning the same data.

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

Sidebar

Ask A Question

Stats

  • Questions 508k
  • Answers 508k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer you could group already in the database. or sort by… May 16, 2026 at 4:19 pm
  • Editorial Team
    Editorial Team added an answer Save a version number (string) to the preferences file and… May 16, 2026 at 4:19 pm
  • Editorial Team
    Editorial Team added an answer Unless there's something special about your situation that you're not… May 16, 2026 at 4:19 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I need a simple function which will take a FileInfo and a destination_directory_name as
I created a query that takes a database backup at certain specified location. I
I am trying to create a car make/model form using Javascript or AJAX, problem
So my problem is that I've written a function that takes two Doubles, two
I have a function which wanders through the elements in a page and adjusts
I created my own jQuery plugin in 1.4 and now I need a small
I'm still learning Objective C and iPhone development, so I'm willing to take instruction.
I've been wondering about JavaScript's prototypal nature, and the benefits of it, and have
I've got a Perl script that as one of its final steps creates a
I was wondering what's the best practise for serving a generated big file in

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.