标签: mapkit

iOS:如何将MKMapPoint或CLLocationCoordinate2D转换为UTM?

从我所看到的,这需要一些我不擅长的复杂数学.所以,我在这里问.

有没有人有将MKMapPoint或CLLocationCoordinate2D转换为UTM值的经验?我找到了这个资源(http://www.uwgb.edu/dutchs/usefuldata/UTMFormulas.HTM),但数学是压倒性的.

iphone geolocation utm mapkit cllocationmanager

4
推荐指数
1
解决办法
4413
查看次数

MKPointAnnotation:标题始终可见.可能吗?

我添加标记和标题的代码是这样的:

MKPointAnnotation *annotationPoint = [[MKPointAnnotation alloc] init];
annotationPoint.coordinate = coord;
annotationPoint.title = currentTitle;
[mapView addAnnotation:annotationPoint];
Run Code Online (Sandbox Code Playgroud)

是否可以在标记显示后立即在标记上显示标题并始终可见?非常感谢

map mapkit mkmapview mkannotation ios5

4
推荐指数
1
解决办法
3616
查看次数

检测MKMapView的平移+减速

我正试图在MKMapView上捕捉平移和"滚动结束".使用手势识别器可以轻松进行平移.但是,MKMapView似乎没有在iOS 6中实现UIScrollViewDelegate.这使得解决方案中有没有办法限制MKMapView的最大缩放级别?不行.

思考?理想情况下,我只是利用UIScrollViewDelegate:

-(void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView {
    if ([super respondsToSelector:@selector(scrollViewDidEndDecelerating:)]) {
        [super scrollViewDidEndDecelerating:scrollView];
    }
    [self.myDelegate mapDidFinishPanning:self];
}

-(void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:    (BOOL)decelerate {
    if ([super respondsToSelector:@selector(scrollViewDidEndDragging:)]) {
        [super scrollViewDidEndDragging:scrollView];
    }

if(!decelerate) {
    [self.myDelegate mapDidFinishPanning:self];
}
Run Code Online (Sandbox Code Playgroud)

}

-(void)scrollViewWillBeginDragging:(UIScrollView *)scrollView {
    if ([super respondsToSelector:@selector(scrollViewWillBeginDragging:)]) {
        [super scrollViewWillBeginDragging:scrollView];
    }
    [self.myDelegate mapDidBeginPanning:self];
}
Run Code Online (Sandbox Code Playgroud)

在扩展MKMapView的类中

@interface MyMapView : MKMapView <UIScrollViewDelegate, UIGestureRecognizerDelegate>
Run Code Online (Sandbox Code Playgroud)

但这在iOS 6中不起作用.我在MKMapViewDelegate中看不到任何足够的东西.

uiscrollview mapkit mkmapview mkmapviewdelegate ios6

4
推荐指数
1
解决办法
2094
查看次数

MKMapSnapshotter从快照中删除"Legal"

我正在使用它MKMapSnapshotter创建一个UIImage小的截图MKMapView(并存储供以后使用).但我注意到的一件事是它从快照中删除了"Legal"标签.在这里,答案指出,删除"法律"是违反Apple政策的.这会影响我对应用商店的提交吗?或者它只是在地图中需要,而不是屏幕截图?

我检查了MKMapView和快照rect 的界限.没有区别,因此不可能被裁剪.

mapkit mkmapview ios mkmapsnapshotter

4
推荐指数
1
解决办法
396
查看次数

如何实现随地图旋转的MKAnnotationViews

我有一个带有一些注释的应用程序,直到现在它们只是符合默认行为的符号(例如数字和字母).它们的方向与设备的方向固定,这是合适的.

然而,现在我需要一些需要在实际地图的方向上修复的注释,因此如果地图旋转,则注释符号需要随之旋转(例如,指示河流的箭头).

我不希望它们像地图一样使用地图缩放,但我确实希望它们随地图一起旋转.

我需要一个解决方案,主要用于用户用手指手动旋转地图时,以及由于跟踪时使用航向模式旋转地图.

在谷歌地图上(至少在Android上)这很简单,只需一个简单的MarkerOptions.flat(true)

我希望ios不会太困难,我希望.

提前致谢!

rotation mapkit mkannotation mkannotationview ios

4
推荐指数
1
解决办法
1283
查看次数

通过MapKit获取道路距离 - Swift

如果我想获得公路距离,我应该考虑哪些课程?

我想要的只是从A点到B点的道路距离,我不需要显示一步一步的指示,也不需要显示地图.

有什么建议?

谢谢

mapkit ios swift

4
推荐指数
1
解决办法
3820
查看次数

如何在MKMapView Swift中放大图钉

我希望引脚的位置在敲击引脚时放大,以便位置位于中心.我不知道该怎么做.请帮我.

xcode mapkit mkmapview

4
推荐指数
1
解决办法
2711
查看次数

将MapKit纬度和经度转换为DMS格式

我可以使用以下内容确定地图中心位置的纬度和经度:

func TargetGridReference(outletMapView_PrimaryTargetLocationMap: MKMapView, regionDidChangeAnimated animated: Bool) {

    let ThreatGridReference = outletMapView_PrimaryTargetLocationMap.centerCoordinate

    let mapLatitude = String(format:"%.13f",ThreatGridReference.latitude)

    let mapLongitude = String(format:"%.13f",ThreatGridReference.longitude)
    let latAndLong = "Lat: \(mapLatitude) \nLong: \(mapLongitude)"

    self.outletLabel_TargetGridReference.text = latAndLong

    tempThreatGridReference = ThreatGridReference
    tempThreatGridReferenceLat = mapLatitude
    tempThreatGridReferenceLon = mapLongitude

}
Run Code Online (Sandbox Code Playgroud)

这让我在巴黎艾菲尔铁塔的纬度如下:

Lat:  48.8582487759147
Long:  2.2945180844931
Run Code Online (Sandbox Code Playgroud)

如何在Swift中将上述内容转换为以下DMS格式?:

lat: 48° 51' 29.6956" N
long: 2° 17' 40.2651" E
Run Code Online (Sandbox Code Playgroud)

MapKit是否提供自动转换到各种坐标系统,如UTM,UPS,MGRS等?

mapkit ios swift

4
推荐指数
1
解决办法
1386
查看次数

错误:'代理必须在收集用户位置时响应locationManager:didUpdateLocations:'

所以我想在用户点击按钮时收集用户位置,并稍后在我的应用中使用该位置.使用我当前的实现,当点击按钮时,应该提示用户允许共享位置,然后他们应该登录到应用程序(如果您想知道的话,通过Firebase匿名),并且应该打印用户位置信息到控制台.提示有效,但是在点击允许位置按钮后,我的应用程序终止due to uncaught exception 'NSInternalInconsistencyException'

原因是 'Delegate must respond to locationManager:didUpdateLocations:'

这很奇怪,因为didUpdateLocations:我的代码中有一个函数.

我不知道发生了什么,任何帮助表示赞赏.我的ViewController代码如下,谢谢!

/*
* Copyright (c) 2016 Ahad Sheriff
*
*/

import UIKit
import Firebase
import CoreLocation

class LoginViewController: UIViewController {

    // MARK: Properties
    var ref: FIRDatabaseReference! // 1
    var userID: String = ""

    var locationManager = CLLocationManager()

    override func viewDidLoad() {
        super.viewDidLoad()
        ref = FIRDatabase.database().reference() // 2
    }

    @IBAction func loginDidTouch(sender: AnyObject) {

        //ask user to enable location services
        locationManager.requestWhenInUseAuthorization()

        if CLLocationManager.locationServicesEnabled() {
            //collect user's …
Run Code Online (Sandbox Code Playgroud)

core-location mapkit swift

4
推荐指数
1
解决办法
5460
查看次数

代表必须响应locationManager:didUpdateLocations swift eroor

Hy家伙,我正在使用swift 3.0制作应用程序,但我很快遇到了一个问题.我设置必要的功能来请求使用位置的权限,但每次运行应用程序时都会出现同样的错误...

Viewcontroller.h

import UIKit
import MapKit

class ViewController: UIViewController {

    let locationManager = CLLocationManager()

    override func viewDidLoad() {
        super.viewDidLoad()
        locationManager.delegate = self
        locationManager.desiredAccuracy = kCLLocationAccuracyBest
        locationManager.requestWhenInUseAuthorization()
        locationManager.requestLocation()
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }


}

extension ViewController : CLLocationManagerDelegate {
    private func locationManager(manager: CLLocationManager, didChangeAuthorizationStatus status: CLAuthorizationStatus) {
        if status == .authorizedWhenInUse {
            locationManager.requestLocation()
        }
    }

    private func locationManager(manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
        if locations.first != nil {
            print("location:: …
Run Code Online (Sandbox Code Playgroud)

mapkit cllocationmanager swift

4
推荐指数
4
解决办法
6409
查看次数