0

我正在尝试围绕给定坐标获取全景图片。但是,我的查询总是返回零张照片。这是我正在使用的代码。

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

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

这总是返回零结果。请帮我解决我做错了什么。

4

1 回答 1

1

你有 x 和 y 坐标错误的方式。

交换这些回报:-

{"count":379,"has_more":true,"map_location":{"lat":60.118290103595498,"lon":-149.45469385385852,"panoramio_zoom":6}

ETC

ps 不要依赖计数是否正确。使用 has_more 标志。

于 2015-01-13T03:13:38.900 回答