mapkit

How to draw GeoJSON in Apple Maps as overlay using Swift 3

醉酒当歌 提交于 2019-12-05 01:44:08
问题 I am trying to draw the following GeoJSON data as an overaly in MKMapView. The GeoJSON File is as below. { "type": "FeatureCollection", "features": [ { "type": "Feature", "properties": { "Name": "line1" }, "geometry": { "type": "LineString", "coordinates": [ [ 76.35498046875, 25.145284610685064 ], [ 81.36474609375, 25.06569718553588 ], [ 83.91357421875, 23.301901124188877 ], [ 82.001953125, 22.004174972902003 ], [ 78.33251953125, 21.248422235627014 ], [ 76.31103515625, 21.268899719967695 ] ]

Dotted line on map view

放肆的年华 提交于 2019-12-05 01:21:05
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; } You can use the lineDashPattern property to create the pattern you want for the line. MKPolylineRenderer is a

MKLocalSearch doesn't provide the same results as search in native Apple Maps app

倾然丶 夕夏残阳落幕 提交于 2019-12-05 00:38:19
问题 When I search in MKLocalSearch and Apple Maps using the same string I get different results, usually in Apple Maps I get a lot of different locations but in MKLocalSearch I get only one. Apple Maps: My app using MKLocalSearch: In both cases I was searching being in Berlin and in MKLocalSearchRequest I set .region property of Berlin region Which services does Apple use for their location search? 回答1: After doing some searching I've investigated that MKLocalSearchCompleter is the class that

Zoom to fit current location and annotation on map

天大地大妈咪最大 提交于 2019-12-05 00:32:51
I am new to swift (iOS programming in general) and am trying to figure out how to zoom a map out to fit 2 points on the map. Currently I have var zoomRect = MKMapRectNull; var myLocationPointRect = MKMapRectMake(myLocation.longitude, myLocation.latitude, 0, 0) var currentDestinationPointRect = MKMapRectMake(currentDestination.longitude, currentDestination.latitude, 0, 0) zoomRect = myLocationPointRect; zoomRect = MKMapRectUnion(zoomRect, currentDestinationPointRect); Which does nothing. Do I have to apply zoomRect to the map somehow? zisoft MKMapRectUnion computes and returns a new rect,

missing required architecture i386 in file

守給你的承諾、 提交于 2019-12-05 00:20:52
I am having trouble building my app after adding MapKit and CoreLocation frameworks. They are both 4.3 frameworks, and the app used to work fine with UIKit, CoreGraphics, and Foundation, just giving me problems with these two. Not sure what the required architecture is, there aren't any bugs in the code. Any help is appreciated! ld: warning: ignoring file /Users/F3d3r3r/Desktop/testNav4_3/MapKit.framework/MapKit, missing required architecture i386 in file ld: warning: ignoring file /Users/F3d3r3r/Desktop/testNav4_3/CoreLocation.framework/CoreLocation, missing required architecture i386 in file

Reposition legal label ( MKAttributionLabel )

梦想的初衷 提交于 2019-12-04 23:40:38
I'd want to move the Legal label to the right side. On iOS 6 and 7 the below solution was working fine, however on iOS 8.3 it seems to not work. I get the label, then with a timer (0.1 sec) in viewDidLayoutSubviews I call this method : -(void)moveLegalLabel { UIView * legalLink = [self attributionView]; legalLink.frame = CGRectMake(self.mapView.frame.size.width - legalLink.frame.size.width - 10, self.mapView.frame.size.height - legalLink.frame.size.height - 10 , legalLink.frame.size.width, legalLink.frame.size.height); legalLink.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin |

Get the Zip Code of the Current Location - iPhone SDK

偶尔善良 提交于 2019-12-04 22:49:52
问题 How to get the zip code of the current location using mapkit, i didn't find any API's for getting this in document. i used coordinate,attitue,horizontal,vertical,course and speed parameters of CLLocationManager, but failed to get the zip code. Could any one please give me the API or sample code to get it done. Is it possible to get the zip code using current location in iphone? 回答1: You can use the latitude and longitude to create an MKPlacemark object, which includes the zip code. Here is a

regiondidchange called several times on app load swift

家住魔仙堡 提交于 2019-12-04 22:41:09
I have a map that when i pan away or type in a location and navigate to it that I want a simple print function to run. I have this accomplished, however, when i first load the app it calls that print function several times until it is finished zooming in. Is there a way to NOT count the initial on app load region change? answer finally found herehttp://ask.ttwait.com/que/5556977 private var mapChangedFromUserInteraction = false private func mapViewRegionDidChangeFromUserInteraction() -> Bool { let view = self.mapView.subviews[0] // Look through gesture recognizers to determine whether this

Monotouch MapKit - annotations - adding a button to bubble

做~自己de王妃 提交于 2019-12-04 22:31:41
问题 Anyone know if there's anyway to get a button onto an annotation? I'd like the location to be selectable - so you can say.. select the location and get all the events at that location by clicking on the button. is this possible? w:// 回答1: Here's the code I used for my annotation, it includes a button on the right side of the bubble. You can set an IBAction to push a new view onto the stack to display whatever you want - (MKAnnotationView *)mapView:(MKMapView *)mV viewForAnnotation:(id

Display spiderfy leaflet annotation MKMapView

不打扰是莪最后的温柔 提交于 2019-12-04 22:10:20
I want to show 100 map points using MKMapView on same lat longs. Please see the link . Same thing i want in iphone. IamAnil If you want to use 100's of annotation then below is the tutorial which will help you. http://www.raywenderlich.com/21365/introduction-to-mapkit-in-ios-6-tutorial In this tutorial if you check the below method it will resolve your issue. (void)plotCrimePositions:(NSData *)responseData { for (id<MKAnnotation> annotation in _mapView.annotations) { [_mapView removeAnnotation:annotation]; } NSDictionary *root = [NSJSONSerialization JSONObjectWithData:responseData options:0