Tag: 纬度经度

如何获取当前的位置名称作为一个string,当我们知道经度和纬度

可能重复: 如何检索用户的当前城市名称? 使用以下方法获取当前位置的纬度和经度 – (void)viewDidLoad { [super viewDidLoad]; locationManager = [[CLLocationManager alloc] init]; locationManager.delegate = self; locationManager.distanceFilter = kCLDistanceFilterNone; // whenever we move locationManager.desiredAccuracy = kCLLocationAccuracyHundredMeters; // 100 m [locationManager startUpdatingLocation]; } – (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation { int degrees = newLocation.coordinate.latitude; double decimal = fabs(newLocation.coordinate.latitude – degrees); int minutes = decimal * […]

如何从位置列表中获取最近的区域?

我有一个API,它返回一个城市内的不同地区的列表与该地区的天气。 我想根据当前位置获取最近的区域。 API返回 区 纬度 经度 天气 如何根据这些数据find最近的区域?

在iPhone上将经度/纬度转换为x / y

我在UIImageView中显示图像,我想将坐标转换为x / y值,以便我可以在此图像上显示城市。 这是我根据我的研究所尝试的: CGFloat height = mapView.frame.size.height; CGFloat width = mapView.frame.size.width; int x = (int) ((width/360.0) * (180 + 8.242493)); //Main lon int y = (int) ((height/180.0) * (90 – 49.993615)); //Mainz lat NSLog(@"x:%iy:%i",x,y); PinView *pinView = [[PinView alloc]initPinViewWithPoint:x andY:y]; [self.view addSubview:pinView]; 这给我167作为x和y = 104,但这个例子应该有值x = 73&y = 294。 mapView是我的UIImageView,只是为了澄清。 所以我第二次尝试使用MKMapKit: CLLocationCoordinate2D coord = […]