开发者

Objective C: Can I charge a fee for my app if I am using Forward GeoCoding (Google API)?

开发者 https://www.devze.com 2023-03-04 23:08 出处:网络
In my application, I am intending to use forward GeoCoding to allow users to enter address into a searchbar and subsequently place a marker on the map.

In my application, I am intending to use forward GeoCoding to allow users to enter address into a searchbar and subsequently place a marker on the map.

Can I double check if the follow method works for what I intend to do?

-(CLLocationCoordinate2D) addressLocation {
    NSString *urlString = [NSString stringWithFormat:@"http://maps.google.com/maps/geo?q=%@&output=csv", 
                       [searchBar.text stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
    //NSString *locationString = [NSString stringWithContentsOfURL:[NSURL URLWithString:urlString]];
    NSError*开发者_JAVA技巧 error;
    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 {
        //Show error
    }
    CLLocationCoordinate2D location;
    location.latitude = latitude;
    location.longitude = longitude;

    return location;
}

I will be calling the above method to get the latitude and longitude and subsequently adding the annotation on the map accordingly. Do I need to register for an APIKey for this? If yes, where do I include it and can I still charge a fee for my app in this case?

Thanks!

Zhen Hoe


Whilst reverse geocoding is included in the api, normal geocoding is not and requires a license from Google. Sadly I can tell you this isn't cheap either, around £8k+ per year depending on volume.

Another approach is to use a free geocoding service, just google it and you will find some. Also other map service providers such as CloudMade do similar things at a fraction of the cost... CloudMade

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号