mapkit

Convert MKCircle Radius to CoreGraphics Arc Radius

人盡茶涼 提交于 2019-12-06 12:39:59
问题 How can I convert an MKCircle's radius (in meters) into a value I can use to draw a circle using core graphics in an MKOverlayPathView subclass? In the following code the radius is hardcoded to 50 but I need it to reflect the radius of the MKCircle. For the position I use MKMapPointForCoordinate() to convert the MKCircle's coordinate to an MKMapPoint, then convert the MKMapPoint to a point using MKOverlayPathView's pointForMapPoint:. But how can I convert the MKCircle's radius into a relative

How can I determine a CLLocation or MKPlacemark from an address?

眉间皱痕 提交于 2019-12-06 12:35:34
问题 I've seen API documentation and demo after demo on how to do a reverse geocode - to get an address, given a Lat/Long location. I need to do the reverse. I'm assuming that this is already solved problem since Apple's MapKit API avoids it entirely. 回答1: One way is to use the google webservice like so: -(CLLocationCoordinate2D) addressLocation { NSString *urlString = [NSString stringWithFormat:@"http://maps.google.com/maps/geo?q=%@&output=csv", [addressField.text

Why after upgrading to Xcode 4.2 does MKAnnotation display a warning

爷,独闯天下 提交于 2019-12-06 11:57:07
In Xcode 4.1 there was no problem, but upgrading to Xcode 4.2 I get the following warning: Property 'title' 'copy' attribute does not match the property inherited from 'MKAnnotation' Property 'subtitle' 'copy' attribute does not match the property inherited from 'MKAnnotation' My code: @interface MyAnnotation : NSObject <MKAnnotation> { CLLocationCoordinate2D coordinate; NSString *subtitle; NSString *title; } @property (nonatomic, readonly) CLLocationCoordinate2D coordinate; @property (nonatomic, retain) NSString *subtitle; @property (nonatomic, retain) NSString *title; -(id)initWithCoordinate

MKPolyLineRenderer change color without removing overlay

假装没事ソ 提交于 2019-12-06 11:38:13
问题 I am developing an application that almost replicates Apple maps application behavior. When i touch a route, i need to change its color to blue and change the other ones colors to gray. Is there an efficient way to accomplish this without having to remove the overlays and adding them again ? Thanks. 回答1: Yes: Make sure your annotation view has enabled = YES . Implement -[MKMapViewDelegate mapView:didSelectAnnotationView:] . In that callback, get view and change its properties. 来源: https:/

Animated MKOverlayView

天涯浪子 提交于 2019-12-06 11:13:12
I've run across a couple of similar questions here regarding getting an animated MKOverlayView working property with decent performance (e.g., an animated radar overlay). However, while the answers have helped lead me in the right direction, I still don't fully grasp what I'm missing yet. I've been trying to get this UIImageView method working, which simply adds an UIImageView as a subview of the MKOverlayView, then adds the necessary images in the animation sequence to its animationImages property. This doesn't seem to work for me as the UIImageView and its associated images are never

Extending iOS KMLViewer Sample to Handle KML NetworkLink Elements

你离开我真会死。 提交于 2019-12-06 10:57:23
I am developing an iOS app that displays KML data over an MKMapView. Apple's KMLViewer sample app has gotten me started. Unfortunately, the KML data I am using relies heavily on linked files via the NetworkLink , Link and href KML elements, and KMLViewer's parser doesn't handle those. I can probably figure out how to add such support, but before I go down that road I was wondering if anyone else has already done this, or if there is a better starting point than KMLViewer. I've looked at Simple KML , but it doesn't seem to support NetworkLink either. Here's how my investigations went: I first

iPhone MapKit - update annotations coordinates and map

谁说我不能喝 提交于 2019-12-06 10:35:27
问题 I use this tutorial for integrating MapKit to my application: http://iphonebcit.wordpress.com/iphone-map-kit-tutorial/ CLLocationCoordinate2D coordinate; coordinate.latitude = 49.2802; coordinate.longitude = -123.1182; NSUInteger count = 1; for(int i = 0; i < 10; i++) { CGFloat latDelta = rand()*.035/RAND_MAX - .02; CGFloat longDelta = rand()*.03/RAND_MAX - .015; CLLocationCoordinate2D newCoord = {coordinate.latitude+latDelta, coordinate.longitude+longDelta}; MapDemoAnnotation* annotation = [

Polyline not drawing from user location (blue dot)

好久不见. 提交于 2019-12-06 09:57:02
问题 - (void)viewDidLoad { [super viewDidLoad]; CLLocationCoordinate2D currentLocation; currentLocation.latitude = self.mapView.userLocation.location.coordinate.latitude; currentLocation.longitude = self.mapView.userLocation.location.coordinate.longitude; CLLocationCoordinate2D otherLocation; otherLocation.latitude = [lati doubleValue]; otherLocation.longitude = [longi doubleValue]; MKPointAnnotation *mka = [[MKPointAnnotation alloc]init]; mka.Coordinate = otherLocation; mka.title = @"!"; [self

MapKit update annotation image

对着背影说爱祢 提交于 2019-12-06 09:47:36
问题 I'm having a problem finding out the way to update a custom MKAnnotationView image after a asynchronous request completes with information about the status of the annotation. So far, I have this: - (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation { static NSString *identifier = @"EstacionEB"; if ([annotation isKindOfClass:[EstacionEB class]]) { EstacionEB *location = (EstacionEB *) annotation; CustomPin *annotationView = (CustomPin *) [_mapita

Draw polyline between given points on the map

纵然是瞬间 提交于 2019-12-06 09:43:27
I am implementing an iOS application, and I want to draw a polyline between several given coordinates on the map. I wrote the code and got the polylines being drawn from my point reaching an infinite point. In other words the beginning point of the line starts from the my given lat and long point, but the end of the line is infinite and not the other point. This is my code... I filled the coordinates in a NSMutableArray called routeLatitudes . The array cells are being filled one for latitude and one for longitude. MKMapPoint* pointArr = malloc(sizeof(CLLocationCoordinate2D) * [routeLatitudes