ahmed elbarbary

ahmed elbarbary

  • NA
  • 1.6k
  • 254.9k

How to fill marker by result of latitude and longitude from

Dec 30 2019 6:27 PM

How to fill marker by result of latitude and longitude from json result? using angular 7 ?

  1. this.partDetailsService.getLocationData(locationArr).subscribe(res => {                       console.log(res);             res.forEach((item, index) => { var dataLocation = res[index]['_source']['GPS1'];                   console.log(dataLocation); var locationsLatLng = dataLocation.split(',');            console.log(locationsLatLng); });  

I have foreach loop get GPS1 latitude and longitude from service return latitude and longitude based on array of locationsId then store it separated by comma , on variable locationsLatLng (lat,lng) as following :

  1. 52,70  
  2. 30,40   
  3. 20,60   
  4. 50,100

How to file marker by latitude and longitude by values exist on locationsLatLng

  1. markers: marker[] = [ {           lat: ?,           lng: ? }  

Answers (3)