相关疑难解决方法(0)

用于计算轴承w/Haversine功能的CLL位类别

我正在尝试为CLLocation编写一个类别,以将轴承返回到另一个CLLocation.

我相信我对公式做错了(计算不是我的强项).返回的轴承始终关闭.

我一直在看这个问题并尝试应用被接受为正确答案的更改及其引用的网页:

计算两个CLLocationCoordinate2D之间的方位

http://www.movable-type.co.uk/scripts/latlong.html

谢谢你的任何指示.我已经尝试将其他问题的反馈结合起来,而我仍然没有得到任何东西.

谢谢

这是我的类别 -

----- CLLocation + Bearing.h

#import <Foundation/Foundation.h>
#import <CoreLocation/CoreLocation.h>


@interface CLLocation (Bearing)

-(double) bearingToLocation:(CLLocation *) destinationLocation;
-(NSString *) compassOrdinalToLocation:(CLLocation *) nwEndPoint;

@end
Run Code Online (Sandbox Code Playgroud)

--------- CLLocation + Bearing.m

#import "CLLocation+Bearing.h"

double DegreesToRadians(double degrees) {return degrees * M_PI / 180;};
double RadiansToDegrees(double radians) {return radians * 180/M_PI;};


@implementation CLLocation (Bearing)

-(double) bearingToLocation:(CLLocation *) destinationLocation {

 double lat1 = DegreesToRadians(self.coordinate.latitude);
 double lon1 = DegreesToRadians(self.coordinate.longitude);

 double lat2 = DegreesToRadians(destinationLocation.coordinate.latitude);
 double lon2 = DegreesToRadians(destinationLocation.coordinate.longitude);

 double dLon = lon2 …
Run Code Online (Sandbox Code Playgroud)

iphone core-location mapkit haversine cllocation

27
推荐指数
2
解决办法
1万
查看次数

在iOS SDK中承载当前位置

我刚刚完成了一个Android应用程序,其中我使用了当前位置的方位值.现在我正在尝试为iOS做同样的应用程序.但是没有办法在iOS sdk中获取当前位置?

我不知道如何计算两个CLLocationCoordinate2D 之间的方位(计算两个CLLocationCoordinate2D之间的方位).

***我需要承担当前位置.

任何帮助对我来说都很棒.

bearing cllocationmanager ios

7
推荐指数
1
解决办法
4626
查看次数

谷歌地图在iOS中闪烁

我在我的应用程序中通过pod使用Google Maps SDK for iOS版本:1.10.17867.0.但是当我在特定位置初始化地图时,所有标题和地图都会开始闪烁.示例代码(swift):

import UIKit
import GoogleMaps

class ViewController: UIViewController {

  override func viewDidLoad() {
    super.viewDidLoad()
    self.view.backgroundColor = UIColor.whiteColor();
    var camera = GMSCameraPosition.cameraWithLatitude(19.0176147, longitude: 72.8561644, zoom:18) 
    // even try this: 28.6469655, longitude: 77.0932634, zoom:10 
    var mapView = GMSMapView.mapWithFrame(CGRectZero, camera:camera)

    var marker = GMSMarker()
    marker.position = camera.target
    marker.snippet = "Hello World"
    marker.appearAnimation = kGMSMarkerAnimationPop
    marker.map = mapView

    self.view = mapView
  }
}
Run Code Online (Sandbox Code Playgroud)

google-maps ios cocoapods google-maps-sdk-ios swift

5
推荐指数
1
解决办法
1686
查看次数

Swift:如何在2个坐标之间平滑移动GMSMarker

我添加了一条路线,并且我还添加了路标。我想沿着路线将标记从一个gps坐标点平滑移动到另一个gps坐标点。谁能帮我这个?这是用于添加标记的代码。

func configureMapAndMarkersForRoute() {
  viewGMap.camera = GMSCameraPosition.cameraWithTarget(mapTasks.originCoordinate, zoom: 9.0)

  originMarker = GMSMarker(position: self.mapTasks.originCoordinate)
  originMarker.map = self.viewGMap
  originMarker.icon = GMSMarker.markerImageWithColor(UIColor.greenColor())
  originMarker.title = self.mapTasks.originAddress

  destinationMarker = GMSMarker(position: self.mapTasks.destinationCoordinate)
  destinationMarker.map = self.viewGMap
  destinationMarker.icon = GMSMarker.markerImageWithColor(UIColor.redColor())
  destinationMarker.title = self.mapTasks.destinationAddress

  if waypointsArray.count > 0 {
    var i = 0
    for waypoint in waypointsArray {
      let lat: Double = (waypoint.componentsSeparatedByString(",")[0] as NSString).doubleValue
      let lng: Double = (waypoint.componentsSeparatedByString(",")[1] as NSString).doubleValue

      let marker = GMSMarker(position: CLLocationCoordinate2DMake(lat, lng))
      marker.map = viewGMap
      marker.icon = GMSMarker.markerImageWithColor(UIColor.purpleColor())
      marker.title = locationNameArray[i]
      markersArray.append(marker)
      i …
Run Code Online (Sandbox Code Playgroud)

xcode google-maps ios swift

2
推荐指数
1
解决办法
4668
查看次数