//地图区域改变完成后会调用此接口
- (void)mapView:(BMKMapView *)mapView regionDidChangeAnimated:(BOOL)animated
{
// 当前屏幕中心点的经纬度
double centerLongitude = self.mapView.region.center.longitude;
double centerLatitude = self.mapView.region.center.latitude;
NSLog(@"==中心点经纬度 %f,%f",centerLatitude, centerLongitude);
//当前屏幕显示范围的经纬度
CLLocationDegrees pointssLongitudeDelta = self.mapView.region.span.longitudeDelta;
CLLocationDegrees pointssLatitudeDelta = self.mapView.region.span.latitudeDelta;
//左上角
double leftUpLong = centerLongitude - pointssLongitudeDelta/2.0;
double leftUpLati = centerLatitude + pointssLatitudeDelta/2.0;
//右上角
double rightUpLong = centerLongitude + pointssLongitudeDelta/2.0;
double rightUpLati = centerLatitude + pointssLatitudeDelta/2.0;
//左下角
double leftDownLong = centerLongitude - pointssLongitudeDelta/2.0;
double leftDownlati = centerLatitude - pointssLatitudeDelta/2.0;
//右下角
double rightDownLong = centerLongitude + pointssLongitudeDelta/2.0;
double rightDownLati = centerLatitude - pointssLatitudeDelta/2.0;
NSLog(@"\n 左上 %f,%f---------\n 右上 %f,%f-------\n 左下 %f,%f----- \n 右下 %f,%f",leftUpLong,leftUpLati,rightUpLong,rightUpLati,leftDownLong,leftDownlati,rightDownLong,rightDownLati);
}
iOS-百度地图获取屏幕显示范围内的经纬度
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
推荐阅读更多精彩内容
- 判断一个经纬度是否落在一个指定的区域范围内有多种实现方式比如:调用地图API,Path2D 包和射线法等多种方式,...
- 需求 每次车辆状态改变时(相当于一个定时任务)将需要显示的marker覆盖物+自己当前位置显示在屏幕范围内 官方文...