petite modif let
This commit is contained in:
		
							parent
							
								
									993be2e1b0
								
							
						
					
					
						commit
						1726ec44b2
					
				
					 1 changed files with 6 additions and 6 deletions
				
			
		| 
						 | 
				
			
			@ -32,16 +32,16 @@ export class CardRestoComponent implements OnInit {
 | 
			
		|||
  }
 | 
			
		||||
 | 
			
		||||
  getDistanceFromLatLonInKm(lat1 : number , lon1 : number, lat2 : number, lon2 : number) {
 | 
			
		||||
    var R = 6371; // Radius of the earth in km
 | 
			
		||||
    var dLat = this.deg2rad(lat2-lat1);  // deg2rad below
 | 
			
		||||
    var dLon = this.deg2rad(lon2-lon1); 
 | 
			
		||||
    var a = 
 | 
			
		||||
    let R = 6371; // Radius of the earth in km
 | 
			
		||||
    let dLat = this.deg2rad(lat2-lat1);  // deg2rad below
 | 
			
		||||
    let dLon = this.deg2rad(lon2-lon1); 
 | 
			
		||||
    let a = 
 | 
			
		||||
      Math.sin(dLat/2) * Math.sin(dLat/2) +
 | 
			
		||||
      Math.cos(this.deg2rad(lat1)) * Math.cos(this.deg2rad(lat2)) * 
 | 
			
		||||
      Math.sin(dLon/2) * Math.sin(dLon/2)
 | 
			
		||||
      ; 
 | 
			
		||||
    var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); 
 | 
			
		||||
    var d = R * c * 1000; // Distance in meters
 | 
			
		||||
    let c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); 
 | 
			
		||||
    let d = R * c * 1000; // Distance in meters
 | 
			
		||||
    return d;
 | 
			
		||||
  }
 | 
			
		||||
  
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue