mapkit

Display route between two points on map with mapkit :ios7

杀马特。学长 韩版系。学妹 提交于 2019-12-04 21:35:54
问题 I want to display point to point route between two points on map with in my app. I am using MKDirectionsRequest for this.I am trying to find route between pune to mumbai.I am getting an error as a response. Error message : Error Domain=MKErrorDomain Code=5 "Directions Not Available" UserInfo=0x9d80dd0 { NSLocalizedFailureReason=A route to the nearest road cannot be determined., NSLocalizedDescription=Directions Not Available, MKDirectionsErrorCode=6, MKErrorGEOError=-403 } Is

Offline reverse geocoding on iOS

雨燕双飞 提交于 2019-12-04 21:11:10
There are lots of existing questions relating to this issue, but I have looked at as many of them as I could find and did not get an answer. I'm trying to perform an offline reverse geocoding lookup on iOS based on a latitude and longitude. I'd like to be able to provide a latitude and longitude, and be provided with the country in which that point lies. I can do this with Geonames (such as: http://api.geonames.org/countryCode?lat=45.03&lng=8.2&username=demo ), but I need a similar ability offline, without Internet functionality on the device. CLLocation does not provide offline services that

Custom annotation showing same image for all different types of POI's

久未见 提交于 2019-12-04 20:45:26
I need to show different annotation for different cat_ID on map. in this question i am including only two categories . let item = json["data"].arrayValue var count = 0 initMK() dispatch_async(dispatch_get_main_queue()) { while count < item.count{ let lat = item[count]["comp_lat"].stringValue let lng = item[count]["comp_lng"].stringValue if item[count]["ct_id"].stringValue == "783"{ self.state = "Jachthavens" let poi = MKPointAnnotation() let coordinates = CLLocationCoordinate2D(latitude: Double(lat)!, longitude: Double(lng)!) poi.coordinate = coordinates poi.title = item[count]["comp_name_pub"

how can I center my map on the annotation view only when it is close to the edge of the screen?

落花浮王杯 提交于 2019-12-04 20:30:41
In my swift application I'm using MapKit and I'm adding some annotations to the map. Currently, thanks to this question: Trying to get the span size in meters for an iOS MKCoordinateSpan I managed to create a functionality that centers my map on the annotation when user presses it. This is the code for it: let span = mapView.region.span let centerView = mapView.region.center let loc1 = CLLocation(latitude: centerView.latitude - span.latitudeDelta * 0.5, longitude: centerView.longitude) let loc2 = CLLocation(latitude: centerView.latitude + span.latitudeDelta * 0.5, longitude: centerView

MKMapPoint with MKMapPointMake from MKMapRect

前提是你 提交于 2019-12-04 19:43:53
I have the following code: MKMapRect mRect = self.mapView.visibleMapRect; MKMapPoint eastMapPoint = MKMapPointMake(MKMapRectGetMaxX(mRect), MKMapRectGetMaxY(mRect)/2); MKMapPoint northMapPoint = MKMapPointMake(MKMapRectGetMaxX(mRect)/2, 0); MKMapPoint southMapPoint = MKMapPointMake(MKMapRectGetMaxX(mRect)/2, MKMapRectGetMaxY(mRect)); MKMapPoint westMapPoint = MKMapPointMake(0, MKMapRectGetMaxY(mRect)/2); I am converting these to CLLocationCoordinate2D with MKCoordinateForMapPoint . For example: CLLocationCoordinate2D northCoords = MKCoordinateForMapPoint(northMapPoint); Along with northCoords

iPhone 3.0 MapKit - Multiple Annotations in the Same Location

淺唱寂寞╮ 提交于 2019-12-04 19:38:32
Background: I have created an application that allows users to submit an entry to an online database, and view other entries from that database. These entries contain geocodes for latitude and longitude which are used for positioning the annotations on the MapKit. Users can submit the location using either their current location or an address, which is then geocoded. Question: What is the proper or suggested method of handling annotations that fall on the exact same coordinates? I was thinking of checking if there are any duplicate geocodes in the XML file pulled from the database and creating

MKannotationView with UIButton as subview, button don't respond

二次信任 提交于 2019-12-04 19:03:27
I have add a view with button as a subview to MKAnnotationView CCBigBubleViewController* buble = [[CCBigBubleViewController alloc] init]; [annotationView addSubView:buble.view]; It is shown perfectly, but the button does't respond to tapping. In your implementation of MKAnnotationView, override the hitTest method: - (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event { if (CGRectContainsPoint(_button.frame, point)) { return _button; } return [super hitTest:point withEvent:event]; } Your button will then receive touch events. your annotationView has probably not the right size. Out of

Issue with overlapping annotations (MKAnnotationView) on map

蓝咒 提交于 2019-12-04 18:49:26
问题 In my iphone application, I'm using MapKit with MKMapView and custom MKAnnotationView. The problem is when annotations overlap on map (in my app, annotations are photos and those photos may overlap) and when you tap on the annotation that appears on front, it's another annotation (on back) which receives the event (seems to be random). I didn't find any way to send the event to the front annotation. I cannot believe this bug/problem doesn't have any solution! Z ordering and Order of

Convert MKCircle Radius to CoreGraphics Arc Radius

不想你离开。 提交于 2019-12-04 18:45:48
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 distance? MKCircle *circle = [self circleForLocation:location]; CGPoint relativePoint = [self

Removing Annotation using the Annotations Coordinates

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-04 18:45:01
I am using Firebase to get annotations on to mapView. This is done through the following: func getMarkers() { dbRef.observe(.value, with: { (snapshot) in for buildings in snapshot.children { let buildingsObject = Buildings (snapshot: buildings as! FIRDataSnapshot) let latDouble = Double(buildingsObject.latitude!) let lonDouble = Double(buildingsObject.longitude!) self.telephoneNumber = buildingsObject.number let annotation = myAnnotationView.init(title: buildingsObject.content!, coordinate: CLLocationCoordinate2D.init(latitude: latDouble!, longitude: lonDouble!), duration: buildingsObject