قالب وردپرس درنا توس
Home / IOS Development / Is this a CLLocation distance calculation error? Is there a solution? : iOSProgramming

Is this a CLLocation distance calculation error? Is there a solution? : iOSProgramming



After calculating zero distance with [CLLocation distanceFromLocation:]subsequent calculations of zero distance are different than before the zero distance. Is there a solution to get consistent results?

NSLog (@ "loc2 =%. 20f% .20f", loc2.coordinate.longitude, loc2.coordinate.latitude);

NSLog (@ "result1 =%. 20f", [loc1 distanceFromLocation:loc2]);

NSLog (@ "loc1 =%. 20f% .20f", loc1.coordinate.longitude, loc1.coordinate.latitude);

NSLog (@ "loc2 =% .20f% .20f", loc2.coordinate.longitude, loc2.coordinate.latitude);

NSLog (@ "trash =% .20f", [loc1

distanceFromLocation:loc1]);

NSLog (@ "loc1 =%. 20f% .20f", loc1.coordinate.longitude, loc1.coordinate.latitude);

NSLog (@ "loc2 =%. 20f% .20f", loc2.coordinate.longitude, loc2.coordinate.latitude);

NSLog (@ "result2 =% .20f", [loc1 distanceFromLocation:loc2]);

NSLog (@ "loc1 =%. 20f% .20f", loc1.coordinate.longitude, loc1.coordinate.latitude);

NSLog (@ "loc2 =%. 20f% .20f", loc2.coordinate.longitude, loc2.coordinate.latitude);

I would not expect to see the result1 and result2 different in the output:

2019-05- 24 14: 12: 06.361771-0400 … – [RouteParserRoute distanceInNauticalMilesFrom:to:] loc1 = -96.257993999999996503 90 33.44624999999999914735

2019-05 -24 14: 12: 06.361872-0400 … – [RouteParserRoute distanceInNauticalMilesFrom:to:] loc2 = -97.03769400000000189266 32.89723099999999789134

2019-05-24 14: 12: 06.362052-0400 … – [19659016] result1 = 94849.40430844188085757196 [19659002] 2019-05-24 14: 12: 06.362263-0400 … – [RouteParserRoute distanceInNauticalMilesFrom:to:] loc1 = -96.25799399999999650390 33.44624999999999914735

2019-05-24 14: 12: 06.362375-0400. .. – [RouteParserRoute distanceInNauticalMilesFrom:to:] loc2 = -97.03769400000000189266 32.89723099999999789134

2019-05-24 14: 12: 06.362599-0400 … – [RouteParserRoute distanceInNauticalMilesFrom:to:] trash = 0.00000000000000000000

2019-05-24 14: 12: 06.362776] 0400 … – [RouteParserRoute distanceInNauticalMilesFrom:to:] loc1 = -96.25799399999999650390 33.44624999999999914735

2019-05-24 14: 12: 06.362899-0400 … – [RouteParserRoute distanceInNauticalMilesFrom:to:] loc2 = -97.03769400000000189266 32.89723099999999789134

2019-0530 14: 12: 06.363118-0400 … – [RouteParserRoute distanceInNauticalMilesFrom:to:] result2 = 94676.80041732524114195257

2019-05-24 14: 12: 06.363339-0400 … – [RouteParserRoute distanceInNauticalMilesFrom:to:] loc1 = -96.25799399999999650390 33.44624999999999914735 [19659002] 05-24 14: 12: 06.363574-0400 … – [RouteParserRoute distanceInNauticalMilesFrom:to:] loc2 = -97.03769400000000189266 32.89723099999999789134


Source link