I have the following content:
Location:
lat: 43.252967
lng: 5.379856
__proto__: Object
customerId: "5cd430c65304a21b9464a21a"
id: "5d5a99c62a245117794f1276"
siteId: "5d0ce7c4a06b07213a87a758"
__proto__: Object
1:
Location: {lat: 43.249466, lng: 5.392988}
customerId: "5cd430c65304a21b9464a21a"
id: "5d5ab9472a245117794f1277"
siteId: "5d0ce7c4a06b07213a87a753"
__proto__: Object
2:
Location: {lat: 43.245153, lng: 5.395048}
customerId: "5cd430c65304a21b9464a21a"
id: "5d5ab95d2a245117794f1278"
siteId: "5d0ce7c4a06b07213a87a753"
__proto__: Object
I want to extract lat and lng from this content and store them in the same array and stored this array in an array of arrays. This will define an array per site, containing only lat and lng. One array per site stored in an array containing all the arrays per site.
For this, I have the following code:
   this.customerApi.getPoints(this.currentUser.id)
      .subscribe(response => {
        this.sites = response;
        const ok = this.sites.map(s => s.Location);
        ok.forEach((points) => this.pointsArray.push(points));
        console.log(this.pointsArray);
Unfortunately this gives only one tab and not as much as I have siteIDs like this:
0: {lat: 43.252967, lng: 5.379856}
1: {lat: 43.249466, lng: 5.392988}
2: {lat: 43.245153, lng: 5.395048}
3: {lat: 43.239838, lng: 5.383804}
4: {lat: 44.811343, lng: -0.629233}
5: {lat: 44.807202, lng: -0.614642}
6: {lat: 44.796971, lng: -0.620307}
7: {lat: 44.795266, lng: -0.626272}
length: 8
I would like to have an array of 2 Arrays: 1st:
    0: {lat: 43.252967, lng: 5.379856}
    1: {lat: 43.249466, lng: 5.392988}
    2: {lat: 43.245153, lng: 5.395048}
    3: {lat: 43.239838, lng: 5.383804}
2nd:
1: {lat: 44.811343, lng: -0.629233}
2: {lat: 44.807202, lng: -0.614642}
3: {lat: 44.796971, lng: -0.620307}
4: {lat: 44.795266, lng: -0.626272}
Any help would be really precious here.
I thank you in advance for your help,
 
     
    