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)我得到這樣
的API這總是返回我結果爲零。請幫我解決我做錯的事。
謝謝。有人告訴過你自己有多棒。 – user1191140 2015-01-16 21:00:00