# iOS 求两经纬度中心点，并返回缩放级别，可以参考

+(void)middleCLLocationCoordinate:(CLLocationCoordinate2D)location1 andCllocationCoordinate:(CLLocationCoordinate2D)location2 LOcationCompleteBlock:(MiddleLocationCompleteBlock)CompleteBlock
{
double  maxJ = location1.latitude>location2.latitude?location1.latitude:location2.latitude;
double minJ = location1.latitude<location2.latitude?location1.latitude:location2.latitude;

double maxW = location1.longitude>location2.longitude?location1.longitude:location2.longitude;
double minW = location1.longitude<location2.longitude?location1.longitude:location2.longitude;
if(maxJ==minJ&&maxW==minW)
{
CompleteBlock(maxJ,maxW,17);
}
double diff = maxJ - minJ;
if(diff < (maxW - minW)){
diff = maxW - minW;
}

diff = (10000 * diff)/10000;
double centerJ = minJ*1000000+1000000*(maxJ - minJ)/2.0;
double centerW = minW*1000000+1000000*(maxW - minW)/2.0;
int Mapzoom = 0;

NSArray  *diffArr = [NSArray arrayWithObjects:@"360",@"180",@"90",@"45",@"22",@"11",@"5",@"2.5",@"1.25",@"0.6",@"0.3",@"0.15",@"0.07",@"0.03",@"0",nil];
for(int i = 0; i < diffArr.count; i++){

if((diff - [diffArr[i] doubleValue]) >= 0){
Mapzoom = i;
break;
}else{
Mapzoom = 17;
}
}

if (CompleteBlock) {
CompleteBlock(centerJ/1000000,centerW/1000000,Mapzoom);
}
}

#### iOS 视图缩放或旋转中中心点（AnchorPoint）的设定

2016-03-14 16:13:20

#### iOS开发--点击屏幕获得屏幕坐标

2015-08-18 11:36:23

#### ios-坐标系统(详解UIView的frame、bounds跟center属性[图])

2012-10-26 15:19:13

#### 百度地图<em>中心</em>选<em>点坐标</em>

2018年06月26日 00:00

#### IOS 获取手势点击的坐标

2016-12-30 01:26:29

#### iOS 获取地图视图中心点经纬度

2016-05-30 17:16:23

#### IOS 触摸获取坐标点、缩放图片实例

2015-10-02 19:10:39

#### OC-百度地图计算两个坐标之间的距离

2017-03-20 16:54:09

#### iOS 计算点间距离、点间角度、线间角度

2012-08-13 15:21:11

#### ios view的frame和bounds之区别（位置和大小）

2013-03-24 01:43:57