GoogleMap记下:
来源:互联网 发布:北京 室内 篮球场 知乎 编辑:程序博客网 时间:2024/04/27 20:27
https://developers.google.com/maps/documentation/ios-sdk/
1.
Podfile:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.1'
pod 'GoogleMaps'
2.
使用 iOS 9 和 Xcode 7 时,应用必须通过在其 Info.plist
文件中指定架构来声明其打算打开的 URL 架构。 当用户点击地图上的 Google 徽标时,Google Maps SDK for iOS 会打开 Google Maps 移动应用,因此您的应用需要声明相关的 URL 架构。
要声明 Google Maps SDK for iOS 所使用的 URL 架构,请将以下几行代码添加到您的 Info.plist
中:
<key>LSApplicationQueriesSchemes</key>
<array>
<string>googlechromes</string>
<string>comgooglemaps</string>
</array>
下面的屏幕截图显示了 Xcode 用户界面中的配置:
3.
请求地点授权
如果您的应用使用地点选取器,则您必须请求使用位置服务的权限。先将以下其中一个密钥或将两个密钥都添加到 Info.plist
文件中,以请求“使用时”或“始终”授权:
NSLocationWhenInUseUsageDescription
NSLocationAlwaysUsageDescription
对于地点选取器,请求“使用中”授权足矣,但您可能需要为应用中的其他功能请求“始终”授权。为每个密钥添加一个字符串,告知用户您需要位置服务的原因。例如:
<key>NSLocationWhenInUseUsageDescription</key>
<string>Show your location on the map</string>
4:key
5.火星坐标
const double a = 6378245.0;const double ee = 0.00669342162296594323;+ (CLLocation *)transformToMars:(CLLocation *)location { //是否在中国大陆之外 if ([[self class] outOfChina:location]) { return location; } double dLat = [[self class] transformLatWithX:location.coordinate.longitude - 105.0 y:location.coordinate.latitude - 35.0]; double dLon = [[self class] transformLonWithX:location.coordinate.longitude - 105.0 y:location.coordinate.latitude - 35.0]; double radLat = location.coordinate.latitude / 180.0 * M_PI; double magic = sin(radLat); magic = 1 - ee * magic * magic; double sqrtMagic = sqrt(magic); dLat = (dLat * 180.0) / ((a * (1 - ee)) / (magic * sqrtMagic) * M_PI); dLon = (dLon * 180.0) / (a / sqrtMagic * cos(radLat) * M_PI); return [[CLLocation alloc] initWithLatitude:location.coordinate.latitude + dLat longitude:location.coordinate.longitude + dLon];}+ (BOOL)outOfChina:(CLLocation *)location { if (location.coordinate.longitude < 72.004 || location.coordinate.longitude > 137.8347) { return YES; } if (location.coordinate.latitude < 0.8293 || location.coordinate.latitude > 55.8271) { return YES; } return NO;}+ (double)transformLatWithX:(double)x y:(double)y { double ret = -100.0 + 2.0 * x + 3.0 * y + 0.2 * y * y + 0.1 * x * y + 0.2 * sqrt(fabs(x)); ret += (20.0 * sin(6.0 * x * M_PI) + 20.0 * sin(2.0 * x * M_PI)) * 2.0 / 3.0; ret += (20.0 * sin(y * M_PI) + 40.0 * sin(y / 3.0 * M_PI)) * 2.0 / 3.0; ret += (160.0 * sin(y / 12.0 * M_PI) + 320 * sin(y * M_PI / 30.0)) * 2.0 / 3.0; return ret;}+ (double)transformLonWithX:(double)x y:(double)y { double ret = 300.0 + x + 2.0 * y + 0.1 * x * x + 0.1 * x * y + 0.1 * sqrt(fabs(x)); ret += (20.0 * sin(6.0 * x * M_PI) + 20.0 * sin(2.0 * x * M_PI)) * 2.0 / 3.0; ret += (20.0 * sin(x * M_PI) + 40.0 * sin(x / 3.0 * M_PI)) * 2.0 / 3.0; ret += (150.0 * sin(x / 12.0 * M_PI) + 300.0 * sin(x / 30.0 * M_PI)) * 2.0 / 3.0; return ret;}
0 0
- GoogleMap记下:
- googlemap
- GoogleMap
- GoogleMap
- 记下
- 记下!!
- 记下
- 记下
- 试用GoogleMap
- GoogleMap api
- googlemap(一)
- googlemap 使用
- googlemap学习
- googleMap api
- GoogleMap 导航
- Flex+GoogleMap
- 记下一笔
- 记下今天
- 项目管理--外包管理
- LinkedIn实时低延迟数据抓取系统Databus
- POJ 1118 求平面上最多x点共线
- 《深入浅出Node.js》学习笔记——(二)模块机制
- 如果解决Jmeter安装之后启动不了的问题
- GoogleMap记下:
- 逻辑运算符
- 并行处理:分叉(fork)和线程(thread)
- 浅谈数据仓库建设中的数据建模方法
- 用 Nginx 来做私有 docker registry 的安全控制
- armeabi-v7a armeabi arm64-v8a
- web.xml v2.5 v3.0模板
- 顺序表应用3:元素位置互换之移位算法
- hdu1846