ahmed elbarbary

ahmed elbarbary

  • NA
  • 1.6k
  • 254.1k

How to Build array of Requests and Build Fork join to get Gp

Dec 29 2019 5:57 PM
I have array of locations Id
locationArr=[40871, 60009, 38149, 40868, 43240, 15299, 53897, 40976, 38151, 23183, 38152, 78579, 23180, 40977, 23176, 39565, 40884, 15298, 38147, 40966, 39669]
this array of locations not fixed difference from part to another I get locationArr by
  1. var locationArr = [];    
  2.       if(Array.isArray(this.resultArray)){    
  3.        this.resultArray.forEach(e=>{    
  4.          locationArr.push(e['Loc']);    
  5.        })  
  6.      }    
I need to pass all locationId to service to get GPS1 latitude and longtude for every locationId on array locationArr.
service get location by locationId for only one locationId
  1. getLocationData(id: number) {    
  2. console.log("server "+id)    
  3. return this.http.get('http://192.168.7.45:9200/location/_doc/'+id);    
  4. }    
  5.    
  6.    
  7. this.partDetailsService.getLocationData(this.LocationId).subscribe(res => {            
  8.          this.dataLocation = res['_source']['GPS1'];       
  9.          var loc = this.dataLocation.split(',');        
  10.          this.lat = loc[0].trim();      
  11.          this.lng = loc[1].trim();   
How to build array of requests and make fork join to get latitude and longtude for more locationId ? 
to summarize i need to pass 
locationArr to 
http://192.168.7.45:9200/location/_doc/
http://192.168.7.45:9200/location/_doc/ locationArr

Answers (1)