ahmed elbarbary

ahmed elbarbary

  • NA
  • 1.6k
  • 278.4k

How to add multilocations on google map using angular 7 ?

Jan 6 2020 12:49 AM
How to add multilocations on google map using angular 7 ?
How to
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 :on component.ts
 
  1. export class ManagelocationsComponent implements OnInit, AfterViewInit {  
  2. markers=[];  
  3. this.partDetailsService.getLocationData(locationArr).subscribe(res => {  
  4. res.forEach((item, index) => {  
  5. let dataLocation = res[index]['_source']['GPS1'];  
  6. })  
  7. console.log("dataLocation values is" + dataLocation );  
Result points for latitude and longtude from browser :
 
dataLocation values is
 
  1. 5.2951916,100.28825170000005,  
  2. 30.788892,120.632503,  
  3. 13.658933,100.634069,  
  4. 10.328074,123.983185,  
  5. 31.332119,120.723465  
 
I need to add latitude and longtude above on  googlemap 
so How to represent this please  

Answers (4)