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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T13:11:31+00:00 2026-05-25T13:11:31+00:00

SEE: http://maps.googleapis.com/maps/api/geocode/json?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA&sensor=false I’m using MySQL. Given a partial or complete address, the Google Map

  • 0

SEE: http://maps.googleapis.com/maps/api/geocode/json?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA&sensor=false

I’m using MySQL.

Given a partial or complete address, the Google Map API will return something like this:

"address_components" : [
            {
               "long_name" : "1600",
               "short_name" : "1600",
               "types" : [ "street_number" ]
            },
            {
               "long_name" : "Amphitheatre Pkwy",
               "short_name" : "Amphitheatre Pkwy",
               "types" : [ "route" ]
            },
            {
               "long_name" : "Mountain View",
               "short_name" : "Mountain View",
               "types" : [ "locality", "political" ]
            },
            {
               "long_name" : "Santa Clara",
               "short_name" : "Santa Clara",
               "types" : [ "administrative_area_level_2", "political" ]
            },
            {
               "long_name" : "California",
               "short_name" : "CA",
               "types" : [ "administrative_area_level_1", "political" ]
            },
            {
               "long_name" : "United States",
               "short_name" : "US",
               "types" : [ "country", "political" ]
            },
            {
               "long_name" : "94043",
               "short_name" : "94043",
               "types" : [ "postal_code" ]
            }
         ]

Assume I am developing an application wherein:

  1. account owners can specify their location, and
  2. search by location is supported

How should I store the address components I get from Google so that I can query for the following:

  1. How many account owners in a particular country?
  2. How many account owners in a particular state?
  3. How many account owners in a particular ZIP/postal code?
  4. etc.

One very easy way is to store individual address components in one table:

TABLE: account
- account_id (PK)
- street_number
- route
- locality
- administrative_area_level_2
- administrative_area_level_1
- country
- postal_code

I’ll just leave blank whatever information Google does not provide (e.g. if account owner did not provide a street number, then the Google API also won’t return the street_number). I think this would be the simplest to query. However, this data won’t be normalized.

Alternatively, I could could design the database to have multiple tables, for example:

TABLE: country
- country_id (PK)
- name

TABLE: administrative_area_level_1
- administrative_area_level_1_id (PK)
- country_id (FK)
- name

… and so on

This will probably normalize the data, but might be a pain to query. Also, missing information might also cause some problems. For example, what if Google returns country and administrative_area_level_2, skipping administrative_area_level_1 (I’m not sure if this is even possible)? administrative_area_level_2 would require a administrative_area_level_1_id as its FK — and without it, the model breaks.

Another idea might be to use a nested set or adjacency model. The data would be normalized and would probably be able to deal better with missing information.

My gut feeling is that the simplest model — the one allowing redundant data — is the best option for me. The data is not coming from me, it’s coming from Google and I think I only need the data so I can do these search-by-location searches. Maybe I won’t run into anomalies?

Any suggestions on how to model this?

  • 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-25T13:11:32+00:00Added an answer on May 25, 2026 at 1:11 pm

    Before you start worrying about how to model the data you retrieve from Google Maps, you might want to check out the terms of service first, at http://code.google.com/apis/maps/terms.html.
    Particularly take note of 10.1.3 (a):

    “You must not copy, translate, modify, or create a derivative work (including creating or contributing to a database) of, or publicly display any Content or any part thereof…”

    I’d say that pretty much explicitly prohibits the kind of application you’re trying to build. If you want to query the address information Google has about one of your account owners, you have to do it using Google’s APIs – not copying their data and doing it in your own application.

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

Sidebar

Related Questions

If I put this URL: http://maps.googleapis.com/maps/api/geocode/json?address=la%20coru%C3%B1a,%20la%20coru%C3%B1a,%20espa%C3%B1a&sensor=false&region=es I get this json object: { results :
How can i show the following result: http://maps.googleapis.com/maps/api/directions/json?origin=hadera&destination=haifa&sensor=false on a map? i want to
I have written down the following code: var url = http://maps.googleapis.com/maps/api/geocode/json?latlng=+position.coords.latitude+,+position.coords.longitude+&sensor=false&callback=parseMe; console.log('URL is --
<html> <head> <title></title> <script type=text/javascript src=http://maps.googleapis.com/maps/api/js?libraries=places&sensor=true></script> <script src=Scripts/jquery-1.4.1.min.js type=text/javascript></script> <script type=text/javascript> $(function () {
See http://support.microsoft.com/kb/312629/EN-US/ I am using reponse.direct in my app as well and I am
Flat-file JMS authentication is easy to set up on Glassfish (see http://docs.sun.com/app/docs/doc/821-0027/aeofg?a=view ). The
I am playing with an MSDN sample to do memory stress testing (see: http://msdn.microsoft.com/en-us/magazine/cc163613.aspx
UPDATE : GWT 2.3 introduces a better mechanism to fight XSRF attacks. See http://code.google.com/webtoolkit/doc/latest/DevGuideSecurityRpcXsrf.html
See here: http://code.google.com/p/ie7-js/ Does anyone have any experience or remarks about this javascript? Is
See here http://www.hanselman.com/blog/InSearchOfThePerfectMonospacedProgrammersFontInconsolata.aspx - for want of a better description - the statement block

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.