ios - 确定 Indoor Atlas 平面图图像的西南和东北

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

我正在尝试使用 IndoorAtlas SDK 构建一个用于室内导航的小示例。我正在使用谷歌地图而不是苹果 map 。 从 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];

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

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

最佳答案

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

-(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)

关于ios - 确定 Indoor Atlas 平面图图像的西南和东北,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39446397/

相关文章:

ios - 在 Objective C 项目中调试 swift 类问题的技术?

objective-c - 有没有办法同时运行 2 个 NSAnimation 对象?

objective-c - UIAlertController 延迟显示

Xcode 4.4 - 未找到图标集

xcode - 在 xcode 7 中使用 Mac App 预配置菜单项

objective-c - 我找不到这个内存泄漏。我以为我正在正确地释放一切

ios - AlertViewController - 其 View 不在窗口层次结构中问题

c# - 如何将 ios 框架添加到 C# Xamarin iOS 项目?

iOS - 应用程序崩溃,因为它试图在没有使用说明的情况下访问隐私敏感数据

iphone - 如何以编程方式检测游戏中心?