ahmed elbarbary

ahmed elbarbary

  • NA
  • 1.6k
  • 278.4k

cannot display latitude and longitud for more locations go ?

Jan 3 2020 9:44 AM
I using angular 7 i work on googlemap
 
google map already display without points pushed on it .
 
meaning all points not display on map although I have latitude and
longtude for more points
but these points not display on map although it pushed it using marker  .
 
step 1 : on html component
  1. <agm-map  
  2. [latitude]="lat"  
  3. [longitude]="lng"  
  4. [zoom]="zoom"  
  5. [disableDefaultUI]="false"  
  6. [zoomControl]="false">  
  7. <agm-marker  
  8. *ngFor="let m of markers;"  
  9. [latitude]="m.lat"  
  10. [longitude]="m.long"  
  11. >  
  12. </agm-marker>  
  13. </agm-map>  
step2 :service.ts
 
  1. getLocationData(ids: Array<number>) {  
  2. let observableBatch = [];  
  3. ids.forEach((id) => {  
  4. observableBatch.push(  
  5. this.http.get('http://192.168.7.45:9200/location/_doc/'+id)  
  6. .map(res => res ));  
  7. });  
  8. return Observable.forkJoin(observableBatch);  
  9. }  
step3 :on component.ts
  1. export class ManagelocationsComponent implements OnInit, AfterViewInit {  
  2. markers=[];  
  3.   
  4. this.partDetailsService.getLocationData(locationArr).subscribe(res => {  
  5. res.forEach((item, index) => {  
  6. let dataLocation = res[index]['_source']['GPS1'];  
  7. var loc = dataLocation.split(',');  
  8. this.markers.push(  
  9. parseFloat(loc[0].trim()),  
  10. parseFloat(loc[1].trim())  
  11. })  
console.log("marker values is" + this.markers);
Result points for latitude and longtude from browser
marker values is
 
  1. 5.2951916,100.28825170000005,30.788892,120.632503,13.658933,100.634069,10.328074,123.983185,31.332119,120.723465,31.9195204,120.1029251,18.588375,99.033632,31.301726,120.673733,31.306624,121.616856,14.3091,121.033,22.783944,113.798342,14.173507,121.129545,29.9211,103.797,10.328071,123.98318500000005,2.679124,101.978932,34.593,133.495,43.6407309,-70.32520110000002,31.8406,120.482,1.37437,103.863366,15.4507,120.605,37.5127,126.786  
google map not show points above why and how to solve it .

Answers (1)