iOS-百度地图_屏幕所显示范围内的经纬度

  //当前屏幕中心点的经纬度

    CGFloat centerLongitude = self.mapView.region.center.longitude;

    CGFloat centerLatitude = self.mapView.region.center.latitude;

    //当前屏幕显示范围的经纬度

    CLLocationDegrees pointssLongitudeDelta = self.mapView.region.span.longitudeDelta;

    CLLocationDegrees pointssLatitudeDelta = self.mapView.region.span.latitudeDelta;

   

    //左上角

    CGFloat leftUpLong = centerLongitude - pointssLongitudeDelta/2.0;

    CGFloat leftUpLati = centerLatitude - pointssLatitudeDelta/2.0;

    //右上角

    CGFloat rightUpLong = centerLongitude + pointssLongitudeDelta/2.0;

    CGFloat rightUpLati = centerLatitude - pointssLatitudeDelta/2.0;

    //左下角

    CGFloat leftDownLong = centerLongitude - pointssLongitudeDelta/2.0;

    CGFloat leftDownlati = centerLatitude + pointssLatitudeDelta/2.0;

    //右下角

    CGFloat rightDownLong = centerLongitude + pointssLongitudeDelta/2.0;

    CGFloat 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);

转载于:https://www.cnblogs.com/dondre/p/4630677.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值