2011-05-09 4 views
1

내 응용 프로그램에서 앞으로 지오 코딩을 사용하여 사용자가 검색 창에 주소를 입력 한 다음지도에 마커를 배치 할 수있게하려고합니다.목표 C : Google API (Forward GeoCoding)를 사용하는 경우 앱 요금을 청구 할 수 있습니까?

다음 방법이 의도 한대로 작동하는지 다시 한 번 확인할 수 있습니까?

-(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* 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; 
} 

나는 위의 방법으로 위도와 경도를 얻고 그에 따라지도에 주석을 추가 할 것입니다. 이를 위해 APIKey에 등록해야합니까? 그렇다면 어디에 넣어야합니까?이 경우 내 앱 요금을 청구 할 수 있습니까?

감사합니다.

젠 괭이

답변

3

하다니 역 지오 코딩이 API에 포함되어 정상 지오 코딩은하지 않고 Google의 라이센스가 필요합니다. 슬프게도 나는 이것도 값이 싸지 않다는 것을 말할 수 있습니다. 볼륨에 따라 연간 £ 8k + 정도입니다.

또 다른 접근 방식은 무료로 지오 코딩 서비스를 사용하는 것입니다. 그냥 Google로 검색하면 더 쉽게 찾을 수 있습니다. 또한 CloudMade와 같은 다른지도 서비스 제공 업체는 비용의 일부만으로 유사한 작업을 수행합니다 ... CloudMade

+0

고마워! 하지만 지오 코딩 부분이 앱의 핵심이 아니라는 점이 중요합니까? 또한 사용자가 길 찾기를 요청하려고 할 때 map.app을 호출 했습니까? Google에 메모를 남겼지 만 답장을 보낼지 확실하지 않은 경우 ... – Zhen

관련 문제