Convert span value into meters on a mapview

前端 未结 6 826
小鲜肉
小鲜肉 2020-12-13 06:56

Whenever the user zoom in or out the map i need to know how many meters are currently represented on the map (width or height).

What i need is the inverse function o

6条回答
  •  生来不讨喜
    2020-12-13 07:52

    - (void)mapView:(MKMapView *)map regionDidChangeAnimated:(BOOL)animated {
      MKCoordinateSpan span = mapView.region.span;
      NSLog(@" 1 = ~111 km -> %f = ~ %f km ",span.latitudeDelta,span.latitudeDelta*111);
    }
    

    According to the docs http://developer.apple.com/library/ios/#documentation/MapKit/Reference/MapKitDataTypesReference/Reference/reference.html,

    latitudeDelta

    The amount of north-to-south distance (measured in degrees) to display on the map. Unlike longitudinal distances, which vary based on the latitude, one degree of latitude is always approximately 111 kilometers (69 miles).

提交回复
热议问题