ahmed elbarbary

ahmed elbarbary

  • NA
  • 1.6k
  • 278.4k

how to get values of latitude and longtude on two variables

Dec 30 2019 3:08 PM
How to store values of loc[0] and loc[1] on two variables latitude and longtude
and what type of two variables ?
  1. let lati:string;    
  2. let long:string;     
  3.     
  4. this.partDetailsService.getLocationData(locationArr).subscribe(res => {        
  5.                 console.log(res);      
  6.         res.forEach((item, index) => {      
  7.             let dataLocation = res[index]['_source']['GPS1'];        
  8.             console.log(dataLocation);         
  9.             let loc = dataLocation.split(',');         
  10.             console.log("After");        
  11.             console.log(loc);    success    
  12.             console.log(loc[0].trim());   success    
  13.             console.log(loc[1].trim());  success    
  14.             lati=loc[0].trim();    
  15.             long=loc[1].trim();    
  16.          });      
  17. latitude= result of loc[0].trim after loop finish  
  18. longtude= result of loc[1].trim after loop finish  
  19. and what datatype assigned to two variables ?  
 
suppose I have on dataLocation that store GPS1 as following
52,70
30,40
20,60
50,100
then
latitude variable will have 52,30,20,50
longtude variable will have 70,40,60,100
Ho to create two variables that can give me values above ?

Answers (1)