【问题标题】:Determine SouthWest and NorthEast of Indoor Atlas floor plan image确定 Indoor Atlas 平面图图像的西南和东北
【发布时间】:2016-09-12 08:43:21
【问题描述】:

我正在尝试使用 IndoorAtlas SDK 构建一个用于室内导航的小示例。我使用的是谷歌地图而不是苹果地图。 从 IndoorAtlas 后端获取平面图图像后,我需要创建 GMSCoordinateBounds,它需要 SouthWest 和 NorthEast 坐标来创建边界。我需要知道如何正确确定这些坐标。 目前我的代码看起来像这样:

CLLocationCoordinate2D southWest = CLLocationCoordinate2DMake(self.floorPlan.topRight.latitude,self.floorPlan.topRight.longitude);
CLLocationCoordinate2D northEast = CLLocationCoordinate2DMake(self.floorPlan.bottomLeft.latitude,self.floorPlan.bottomLeft.longitude);


GMSCoordinateBounds *overlayBounds = [[GMSCoordinateBounds alloc] initWithCoordinate:southWest coordinate:northEast];


UIImage *icon = fpImage;
GMSGroundOverlay *overlay =
[GMSGroundOverlay groundOverlayWithBounds:overlayBounds icon:icon];
overlay.bearing = self.floorPlan.bearing;
overlay.map = _mapView;

GMSCameraUpdate *updatedCamera = [GMSCameraUpdate setTarget:self.floorPlan.center zoom:10];
[self.mapView animateWithCameraUpdate:updatedCamera];
self.marker.position = self.camera.target;
_mapView = [GMSMapView mapWithFrame:CGRectZero camera:self.camera];

如何确定上述坐标。尝试上述坐标我没有得到正确的矩形。

还有其他方法可以确定吗?

【问题讨论】:

  • 您找到解决方案了吗?我也面临同样的问题

标签: ios objective-c xcode google-maps-sdk-ios indoor-positioning-system


【解决方案1】:

我找到了一种计算坐标的方法

-(NSArray *)calculateLongLatDegreesInMeters:(CLLocationDegrees)纬度 {

float lat = M_PI * latitude / 180;

// Constants for calculating lengths

float m1 = 111132.92;

float m2 = -559.82;

float m3 = 1.175;

float m4 = -0.0023;

float p1 = 111412.84;

float p2 = -93.5;

float p3 = 0.118;

float eq1 = m1 + (m2 * cos(2 * lat)) + (m3 * cos(4 * lat));

float latitudeDegreeInMeters = eq1 + (m4 * cos(6 * lat));

float longitudeDegreeInMeters = (p1 * cos(lat)) + (p2 * cos(3 * lat)) +    (p3 * cos(5 * lat));

NSString *latDegInMtr = [NSString stringWithFormat:@"%f",latitudeDegreeInMeters];
NSString *lonDegInMtr = [NSString stringWithFormat:@"%f",longitudeDegreeInMeters];


NSArray *arr = [NSArray arrayWithObjects:latDegInMtr,lonDegInMtr, nil];



return arr; //(latitudeDegreeInMeters, longitudeDegreeInMeters)

}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-02-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-02-24
    • 2018-01-26
    相关资源
    最近更新 更多