2014-11-22 39 views
0

我試圖繞過一個給定的座標Panoramio的照片獲得Panoramio的數據。但總是我的查詢返回零照片。這是我正在使用的代碼。不能與API

const double WGS84_a = 6378137.0; 
const double WGS84_b = 6356752.3; 

double Deg2rad(double degrees) { 
    return degrees * M_PI/180.0; 
} 

double Rad2deg(double radians) { 
    return radians * 180.0/M_PI; 
} 
double WGS84EarthRadius(double lat) 
{ 
    double An = WGS84_a*WGS84_a * cos(lat); 
    double Bn = WGS84_b*WGS84_b * sin(lat); 
    double Ad = WGS84_a * cos(lat); 
    double Bd = WGS84_b * sin(lat); 
    return sqrt((An*An + Bn*Bn)/(Ad*Ad + Bd*Bd)); 
} 
MapRect LatLonDestPoint(CLLocationCoordinate2D origin, double halfSideInKm) { 

    double lat = Deg2rad(origin.latitude); 
    double lon = Deg2rad(origin.longitude); 
    double halfSide = 1000*halfSideInKm; 

    double radius = WGS84EarthRadius(lat); 
    double pradius = radius*cos(lat); 

    double latMin = lat - halfSide/radius; 
    double latMax = lat + halfSide/radius; 
    double lonMin = lon - halfSide/pradius; 
    double lonMax = lon + halfSide/pradius; 
    return MKMapRectMake(Rad2deg(latMin), Rad2deg(lonMin), Rad2deg(latMax), Rad2deg(lonMax)); 
} 

現在的座標(60.1190935704,-149.439081366)我得到這樣

http://www.panoramio.com/map/get_panoramas.php?set=public&from=0&to=20&minx=60.029034&miny=-149.619843&maxx=60.209152&maxy=-149.258316&size=medium&mapfilter=true

的API這總是返回我結果爲零。請幫我解決我做錯的事。

回答

1

你有X和Y座標周圍走錯了路。

交換這些回報: -

{ 「計數」:379, 「has_more」:真實的, 「map_location」:{ 「LAT」:60.118290103595498, 「LON」: - 149.45469385385852, 「panoramio_zoom」: 6}

PS不要依賴於計數是正確的。使用has_more標誌。

+0

謝謝。有人告訴過你自己有多棒。 – user1191140 2015-01-16 21:00:00