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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T15:56:46+00:00 2026-05-27T15:56:46+00:00

I am using Google to take an address to get its lat and long.

  • 0

I am using Google to take an address to get its lat and long. I run through about 60-65 address. Each time though I will randomly get 5 or 6 that return a 0,0 coordinate pair.

Every time the indexes that fail are different so I am sure that it is not an address problem.

Here is the code that I am using to return the lat and long

Would it possibly be that I am calling this method from inside a for loop? Maybe calling it over and over so fast will cause it to hick-up sometimes?

-(CLLocationCoordinate2D)addressLocation:(NSString*)_address city:(NSString*)_city state:(NSString*)_state {
    NSString *temp = [NSString stringWithFormat:@"%@, %@, %@", _address, _city, _state];
    NSString *urlString = [NSString stringWithFormat:@"http://maps.google.com/maps/geo?q=%@&output=csv", [temp stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];

    NSError* error = nil;
    NSString *locationString = [NSString stringWithContentsOfURL:[NSURL URLWithString:urlString ] encoding:NSASCIIStringEncoding error:&error];

    NSArray *listItems = [locationString componentsSeparatedByString:@","];
    double latitude = 0.0;
    double longitude = 0.0;

    if([listItems count] >= 4 && [[listItems objectAtIndex:0] isEqualToString:@"200"]) {
        latitude = [[listItems objectAtIndex:2] doubleValue];
        longitude = [[listItems objectAtIndex:3] doubleValue];
    }
    else {
        NSLog(@"Error: %@", [error description]);;
    }

    CLLocationCoordinate2D location;
    location.latitude = latitude;
    location.longitude = longitude;

    return location;
}

EDIT

I have found a work around for the moment if anyone else if having trouble with this.

I go through my list once finding the lat and long of each address.

If there is an error returned from the Google query I add that address to a holding array. Meaning that I passed the rate limit mentioned by Firoze.

After the initial run through is done, I go through the holding array and find the locations of each address.

I am sure that there is a much more cleaner implementation of this but for anyone who is not able to obtain a business license this is a hacked way around.

I hope this helps,
Cory

  • 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-27T15:56:46+00:00Added an answer on May 27, 2026 at 3:56 pm

    You should check to see if locationString is nil. And if so, look at the error. My guess is that your calls are being rate limited.

    You should probably look at Google’s terms of service for this service.

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

Sidebar

Related Questions

Google Gears provides a geolocation API that can take LAC-CELLId information and supply lat-long
When using Google Reader and browsing RSS entries in the Expanded view, entries will
OK, here's my problem I thought that using Google Webfonts would take care of
I have been using Java for a long time, and for quite some time
I am using Google's Annotated Time Line tool to plot data which spans over
I'm using google maps with PHP/MSQL, i've read the documentation on google and take
I am using http://maps.google.com/maps/api/js?sensor=false to retrieve latitude and longitude for address. While retrieving the
When using Google App Engine with Django-nonrel, is there any way to take advantage
I'm using Google Places API to get a list of establishment near a geo
I'm trying to take this example from Google Maps and use an address instead

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.