ios - GoogleMap not showing user's current location properly when drawing path overlay -


I am using GMSPolyline on Google Maps to show the least path between two digits. This map does not properly show the user's current location.

Here's my code, let me know about the improvement, which I can do in my code. Thanks in advance.

  - (zero) Location Manager: (CLLocationManager *) Manager updated location: (NSArray *) locations {/////// If this is a relatively recent event, Close CLLocation to save power * location = [last object of the places]; NSDate * eventDate = location.timestamp; How to NSTimeInterval = [eventDate timeIntervalSinceNow]; If (ABS (cassiterant) & lt; 0.5) {/////// update your marker using location.coordinate.latitude // and location.coordinate.longitude on your map); NSLog (@ "Event Time =% @", Event Date); #pragma mark start Point of polyline draw /////////////// Folklore 23.03 Upvat Derek point was started in the beginning of the plateau Dowro ///// (location.coordinate.longitude == 23.03 ) {[LocationManager stopUpdatingLocation]; } [Maidapad add object: [NSSTING string with format: @ "% F,% F", location.Cordinate.latitude, location.cordinate.langitue]]; GMSMutablePath * path1 = [GMSMutablePath Path]; {// NSString * str1 = mypath [i]; for (int i = 0; i & lt; mypath.count; i ++); NSArray * foo = [Mypath [i] isolated from components: @ ","]; NSString * lat = [EFO ObjectAddindex: 0]; NSString * longi = [EFO ObjectAddindex: 1]; [Path 1 AdCordinate: CLLocationCoordinate2DMake ([Lat float value], [Long Float Valley]]]; } GMSPolyline * rectangle = [GMSPolyline polylineWithPath: path1]; Rectangle.map = mapView_; Marker.position = CLLocationCoordinate2DMake (location.coordinate.latitude, location.coordinate.longitude); Marker.title = @ "Gurukul Road, Ahmedabad"; Marker.snippet = @ "Gujarat"; Marker.map = mapView_; }}  

In the case of latitude and longitude, you should be more accurate there% F and This is not accurate according to the values ​​of latitude and longitude. Use this code ...

  - (zero) Location Manager: (CLLocationManager *) Manager updates the location: (CLLocation *) newLocation FromLocation: (CLLocation *) Old Location {NSLog (@ "updated location location:% @", new location); CLLocation * Current Location = New Location; If (current location! = Zero) {strForCurrentLongitude = [NSString stringWithFormat: @ "% .8f", current location.Cordinate. Lame]; StrForCurrentLatitude = [NSString stringWithFormat: @ "% .8f", Current Location. Coordinate.latitude]; }}  

Take double in this line instead of float.

  [path1 addCoordinate: CLLocationCoordinate2DMake ([lat floatValue], [long float value]]];  

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -