使用Google Place API长途跋涉来自lat的附近地区

时间:2014-02-17 13:26:21

标签: ios iphone google-api google-places-api

我正在使用google place API,即

https://maps.googleapis.com/maps/api/place/search/json?location=33.7167,73.0667&radius=500&type=funeral_home&sensor=false&key=AIzaSyDN1QX-gWUR-mIYo_D21PNFLHHpNQkIkGU

以上链接为我提供了所有附近特定类型的位置。即类型=食物。现在我会把附近的所有咖啡馆和餐馆都带有各自的地址。无论如何,我只能在我的坐标(纬度,长度)附近给我一些区域或地点吗?提前谢谢。

2 个答案:

答案 0 :(得分:2)

我也有类似的用法。我没有办法用google maps api做到这一点。但是,您可以尝试从Autocomplete getPlaces()获取几何(lat,lng)并使用geonames.org API获取附近的sublocalities给出lat,lng和radius

http://api.geonames.org/findNearbyPlaceNameJSON?lat=13.041703&lng=80.251943&radius=5&username=demo

这对我有用: - )

答案 1 :(得分:0)

Arun,如果你可以给出

中的纬度和经度值
 //MAP

    MKCoordinateRegion region;

    CLLocationCoordinate2D coordinate;        

    //if you want to use the GET for getting response for MAP from that URL,you can use this

    coordinate.latitude = [[[Arrresult objectAtIndex:i]objectForKey:@"latitude"]doubleValue];
    coordinate.longitude =[[[Arrresult objectAtIndex:i]objectForKey:@"longitude"]doubleValue] ;

    //or if you want to see the exact or nearest location just give like this 
    coordinate.latitude = @"33.7167";
    coordinate.longitude =@"73.0667";

    region.center = coordinate;

    MKCoordinateSpan span;
    span.latitudeDelta = 0.2;
    span.longitudeDelta = 0.2;
    region.span = span;
    myannotation *annotation = [[myannotation alloc]init];
    annotation.coordinate = coordinate;
    [annotation setTitles:areastring :countrystring];

    [map setRegion:region animated:YES];
    [map addAnnotation:annotation];