今天用到百度地图获取屏幕范围内的经纬度,在此记录一下。
// 当前屏幕中心点的经纬度
double centerLongitude = self.mapView.region.center.longitude;
double centerLatitude = self.mapView.region.center.latitude;
//当前屏幕显示范围的经纬度
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);
扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2025 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号:粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
Copyright © 2013 - 2025 Tencent Cloud.
All Rights Reserved. 腾讯云 版权所有