mkpolyline

MKPolyline broken when using type satelliteFlyover?

只愿长相守 提交于 2020-04-12 06:33:07
问题 I would like to draw some Geodesic Polyline(great circle line) between points on Earth using Satellite Flyover map type. // in viewDidLoad() mapView.mapType = .satelliteFlyover let geodesic = MKGeodesicPolyline(coordinates: [route.airport1, route.airport2], count: 2) self.mapView.addOverlay(geodesic) // rendering method func mapView(_ mapView: MKMapView, rendererFor overlay: MKOverlay) -> MKOverlayRenderer { guard let polyline = overlay as? MKPolyline else { print("else??") return

Polylines are disappearing when zoom closely

二次信任 提交于 2020-03-24 07:21:12
问题 I created seven different polylines. However some of them are disappearing when I zoom in closely. Why it is happening? How can I prevent this? Here is my polyline renderer: func mapView(_ mapView: MKMapView, rendererFor overlay: MKOverlay) -> MKOverlayRenderer { let renderer = MKPolylineRenderer(polyline: overlay as! MKPolyline) renderer.strokeColor = UIColor(red: 1, green: 1, blue: 1, alpha: 0.9) renderer.lineWidth = 2.2 return renderer } //Thousands of parameters sending as a parameter

Show MKPolyline on top of MapView when type is SatelliteFlyover?

。_饼干妹妹 提交于 2020-02-22 07:17:13
问题 I want to show a few MKPolylines on top of MapKit's mapView. The problem is when setting the map type to .satelliteFlyover my polylines will disappear. If I change to just using .satellite they're visible. mapView.type = .satelliteFlyover mapView.addOverlay(polyline) 来源: https://stackoverflow.com/questions/56917088/show-mkpolyline-on-top-of-mapview-when-type-is-satelliteflyover

Determining if Latitude/Longitude Point is in a MKPolygon within Mapview?

☆樱花仙子☆ 提交于 2020-02-18 05:05:10
问题 At this moment, I am trying to figure out whether a coordinate on a MKMapView is within a MKPolygon drawn out ahead of time with latitudes/longitudes. I am using CGPathContainsPoint to determine whether a coordinate is within the polygon on the map but it always returns false regardless of the coordinate I choose. Can anyone please explain what exactly is going wrong? Below is my code in Swift. class ViewController: UIViewController, MKMapViewDelegate @IBOutlet weak var mapView: MKMapView!

Touch events on MKMapView's overlays

ε祈祈猫儿з 提交于 2020-01-29 03:56:44
问题 In the app I'm currently designing I have a MKMapView with overlays on it (customized MKPolylines btw) and I would like to be able to detect touch events on these overlays and assign a specific action to each overlay. Could any one help me on this one ? Thanks ! Benja 回答1: This can be solved combining How to intercept touches events on a MKMapView or UIWebView objects? and How to determine if an annotation is inside of MKPolygonView (iOS). Add this in viewWillAppear: WildcardGestureRecognizer

Create MKPolyline with only recent CLLocations

匆匆过客 提交于 2020-01-15 19:18:26
问题 My app loads the user's past polylines and displays them on the map. Then the app starts tracking and a straight line is drawn from the last updated coordinate to the first, thereby connecting the two separate lines when they should be separate (shown here I want to remove this straight line, so I'm thinking the easiest way would be to discard coordinates that are outside a set time frame (e.g 1 minute), so polylines on the map remain separate. I'm not sure how to do this though... I'm a

Create MKPolyline with only recent CLLocations

依然范特西╮ 提交于 2020-01-15 19:17:54
问题 My app loads the user's past polylines and displays them on the map. Then the app starts tracking and a straight line is drawn from the last updated coordinate to the first, thereby connecting the two separate lines when they should be separate (shown here I want to remove this straight line, so I'm thinking the easiest way would be to discard coordinates that are outside a set time frame (e.g 1 minute), so polylines on the map remain separate. I'm not sure how to do this though... I'm a

Dotted line on map view

拟墨画扇 提交于 2020-01-12 13:47:01
问题 I can create a line between two points fairly easy with the below code (part of it anyways) How could I make the line dotted instead of solid? Also would it be possible to change the opacity the longer the line is? - (MKOverlayRenderer *)mapView:(MKMapView *)mapView rendererForOverlay:(id < MKOverlay >)overlay { MKPolylineRenderer *renderer =[[MKPolylineRenderer alloc] initWithPolyline:overlay]; renderer.strokeColor = [UIColor orangeColor]; renderer.lineWidth = 3.0; return renderer; } 回答1:

Dotted line on map view

好久不见. 提交于 2020-01-12 13:46:07
问题 I can create a line between two points fairly easy with the below code (part of it anyways) How could I make the line dotted instead of solid? Also would it be possible to change the opacity the longer the line is? - (MKOverlayRenderer *)mapView:(MKMapView *)mapView rendererForOverlay:(id < MKOverlay >)overlay { MKPolylineRenderer *renderer =[[MKPolylineRenderer alloc] initWithPolyline:overlay]; renderer.strokeColor = [UIColor orangeColor]; renderer.lineWidth = 3.0; return renderer; } 回答1: