Tag: 经度

将十进制经度/纬度坐标转换为iPad屏幕坐标

我有一个纬度/经度的小数坐标,我想转换成适合iPad坐标系统的区域的点。 我的代码需要经纬度坐标,并将它们转换为笛卡尔坐标(基于此问题: 转换为直angular坐标 )转换的结果是(2494.269287,575.376465)。 这是我的代码(没有编译或运行时错误): #define EARTH_RADIUS 6371 – (void)drawRect:(CGRect)rect { CGPoint latLong = {41.998035, -116.012215}; CGPoint newCoord = [self convertLatLongCoord:latLong]; NSLog(@"Cartesian Coordinate: (%f, %f)",newCoord.x, newCoord.y); //Draw dot at coordinate CGColorRef darkColor = [[UIColor colorWithRed:21.0/255.0 green:92.0/255.0 blue:136.0/255.0 alpha:1.0] CGColor]; CGContextRef context = UIGraphicsGetCurrentContext(); CGContextSetFillColorWithColor(context, darkColor); CGContextFillRect(context, CGRectMake(newCoord.x, newCoord.y, 100, 100)); } -(CGPoint)convertLatLongCoord:(CGPoint)latLong { CGFloat x […]