Tag: mapkit

如何检测何时使用MKUserTrackingBarButtonItem

我目前正试图find一种方法来检测何时使用MKUserTrackingBarButtonItem ,而不是处理mapView:didUpdateUserLocation:委托方法。 我试图设置MKUserTrackingBarButtonItem来调用我的function(检查此线程 ),但诅咒它删除更新位置的行动,我不想。 我没有find任何委托方法触发:/ 感谢您的任何想法。

MapKit – 使地图放大时使路线沿着街道

我写了一个简单的应用程序,它在MapKit上的两个位置之间绘制路线。 我正在使用Google Map API。 我使用了我在网上find的资源,这里是我用来向Google提出请求的代码: _httpClient = [AFHTTPClient clientWithBaseURL:[NSURL URLWithString:@"http://maps.googleapis.com/"]]; [_httpClient registerHTTPOperationClass: [AFJSONRequestOperation class]]; [_httpClient setDefaultHeader:@"Accept" value:@"application/json"]; NSMutableDictionary *parameters = [[NSMutableDictionary alloc] init]; [parameters setObject:[NSString stringWithFormat:@"%f,%f", coordinate.latitude, coordinate.longitude] forKey:@"origin"]; [parameters setObject:[NSString stringWithFormat:@"%f,%f", endCoordinate.latitude, endCoordinate.longitude] forKey:@"destination"]; [parameters setObject:@"true" forKey:@"sensor"]; NSMutableURLRequest *request = [_httpClient requestWithMethod:@"GET" path: @"maps/api/directions/json" parameters:parameters]; request.cachePolicy = NSURLRequestReloadIgnoringLocalCacheData; AFHTTPRequestOperation *operation = [[AFHTTPRequestOperation alloc]initWithRequest:request]; [operation […]

在地图视图中显示多个注释

我是新来映射视图在iOS SDK。 我想在地图视图中使用经纬度显示多个注释。基本上所有经纬度都是从服务器端以json格式来的。 我parsing所有经纬度,并将其保存在不同的数组中。 但是如何一次性显示所有注释。 我能够一次只显示一个注释。下面是我正在使用的单个注释的代码, zoomLocation.latitude = latmpa.doubleValue; zoomLocation.longitude = logmpa.doubleValue; annotationPoint = [[MKPointAnnotation alloc] init]; annotationPoint.coordinate = zoomLocation; annotationPoint.title = @"masjid…."; [mapView selectAnnotation:annotationPoint animated:YES]; [mapView addAnnotation:annotationPoint]; mapView.centerCoordinate = annotationPoint.coordinate; MKCoordinateSpan span; span.latitudeDelta = 1.5; span.longitudeDelta = 1.0; MKCoordinateRegion newRegion; newRegion.center = zoomLocation; newRegion.span = span; [mapView setRegion:newRegion animated:YES];

适用于多个目的地和单一来源的iOS MKDirections

我的应用程序需要从一组10个“最接近”的步行点到用户。我已经看到,MKDirections通过“calculateDirectionsWithCompletionHandler”来处理单个源,目标位置。 我的问题是,我有做10个请求,然后检查哪一个是距离最近的一个,或者有一个发送多个目的地的方法,并且响应将是最接近的一个步行? 谢谢

在iOS地图中search附近

我正在尝试使用MapKit构build一个简单的应用程序,该应用程序将在应用程序启动时自动search特定位置,并在位置的地图上放置引脚。 我看到各种方式来加载位置(纬度/经度等),但没有什么可以让我search具体的商业名称,餐厅名称等。 我期待着与苹果地图合作。 但是,如果Google地图比这样做更好解决问题。 任何帮助,将不胜感激。 谢谢

尝试在MapView中模拟路线

我有一个从文件中parsing的CLLocation对象数组。 我想模拟用户正在沿着这条路线移动,我已经实现了这一点: for (CLLocation *loc in simulatedLocs) { [self moveUser:loc]; sleep(1); } 这是在循环中调用的方法: – (void)moveUser:(CLLocation*)newLoc { CLLocationCoordinate2D coords; coords.latitude = newLoc.coordinate.latitude; coords.longitude = newLoc.coordinate.longitude; CustomAnnotation *annotation = [[CustomAnnotation alloc] initWithCoordinate:coords]; annotation.title = @"User"; // To remove the previous location icon NSArray *existingpoints = self.mapView.annotations; if ([existingpoints count] > 0) { for (CustomAnnotation *annotation in existingpoints) […]

MKMapView setRegion to Small Area导致失败的卫星图像加载

我已经在同一个应用上工作了好几个月,这是一个新问题。 我想知道在苹果地图数据的服务器端是否有变化。 这是问题: 我的应用程序(有时)想要将MKMapView区域设置为在特定位置可能的最充分放大的值。 要做到这一点,我做了这样的事情: self.map.mapType = MKMapTypeHybrid; MKCoordinateRegion region = MKCoordinateRegionMakeWithDistance(CLLocationCoordinate2DMake(item.lat, item.lng), 1.0, 1.0); [self.map setRegion:region animated:NO]; 无论item's坐标是什么,我都会得到网格化的“无卫星图像”背景。 这似乎与卫星图像无关,因为它在美国的许多地区performance一致。 我知道setRegion:animated:可以在事实之后调整区域。 而且我知道一个100万平方米是一个不合理的小区域,试图在相当大的地图上显示。 所以,我试过了 [self.map setRegion:[self.map regionsThatFits:region] animated:NO]; 设置animated:YES似乎阻止了这种情况发生,但我不想animation这些变化。 还有几点意见: 如果我缩小1或2像素,地图图像显示。 试图实现地图委托方法: – mapViewDidFailLoadingMap:withError:没有帮助。 它从来没有被称为。 这似乎是新的。 我在应用程序商店中的应用程序的工作版本,现在展示类似的问题。 我最近在其他stream行的应用程序中看到过这种情况。 有没有解决这个问题的任何想法,或确认这是一个系统性的问题?

从现有坐标mapkit中查找最近的位置

我正在为有多个商店的客户开发iPhone应用程序(目标C)。 我有一个数组中的所有商店(20)的坐标(纬度,长)。 此刻,我正在考虑循环访问商店的坐标数组,并获取用户当前位置到商店位置的距离,然后将它们添加到数组中,并在最小距离上进行sorting。 这是一个正确的方法还是非常资源饥饿? SOF最近的问题是这一个,但它是在python: 提取最近的商店 预先感谢您的build议。

尝试获取iOS MKCoordinateSpan的跨度大小(以米为单位)

当我需要创buildMKCoordinateRegion ,我执行以下操作: var region = MKCoordinateRegion .FromDistance(coordinate, RegionSizeInMeters, RegionSizeInMeters); 非常简单 – 完美的作品。 现在我想存储当前区域跨度的值。 当我看着这个区域region.Span值,它是一个MKCoordinateSpan ,它有两个属性: public double LatitudeDelta; public double LongitudeDelta; 如何将LatitudeDelta值转换为latitudinalMeters ? (所以我可以使用上面的方法重新创build我的区域(稍后)…

在iOS 5上放置一个CLPlacemark在地图上

在iOS 5中,有一种新的方式来转发地理编码地址(像美国加利福尼亚州的1无限循环地址转换为经纬度地址)。 更多信息在这里。 有没有人试图把前进的地理编码CLPlacemark对象在MKMapView? 地理编码后,我有一个CLPlacemark对象,但不知道如何把它放在地图上。 我将不胜感激任何forms的帮助。 Google迄今为止没有任何帮助。