Trying to access data from a large geojson file being read in through mapbox tile server. I can retrieve data up to the "statistics" level, but struggle accessing objects beyond that point. How do I go about this?
map.on('click', 'area-polygon', (e) => {
console.log(e.features[0].properties.statistics);
});
The current output of console.log() is as follows;
{"runs":
{"byActivity":
{"downhill":
{"byDifficulty":
{"easy":
{"count":17,
"lengthInKm":14.4112,
"minElevation":1553.6,
"maxElevation":1999.59,
"combinedElevationChange":1996.04},
"advanced":
{"count":4,
"lengthInKm":2.33805,
"minElevation":1645.08,
"maxElevation":1936.27,
"combinedElevationChange":628.717},
"intermediate":
{"count":11,
"lengthInKm":8.24159,
"minElevation":1553.6,
"maxElevation":2000.42,
"combinedElevationChange":1542.16},
"other":
{"count":5,
"lengthInKm":2.42858,
"minElevation":1595.16,
"maxElevation":2005.37,
"combinedElevationChange":208.312}
}
}
},
"minElevation":1553.6,
"maxElevation":2005.37
},
"lifts":
{"byType":
{"chair_lift":
{"count":3,
"lengthInKm":3.82236,
"minElevation":1553.6,
"maxElevation":1998.59,
"combinedElevationChange":863.786
},
"magic_carpet":
{"count":1,
"lengthInKm":0.962681,
"minElevation":1580.79,
"maxElevation":1742.16,
"combinedElevationChange":161.378},
"gondola":
{"count":1,
"lengthInKm":2.07562,
"minElevation":1580.44,
"maxElevation":1998.42,
"combinedElevationChange":417.985}
},
"minElevation":1553.6,
"maxElevation":1998.59
},
"maxElevation":1998.59,
"minElevation":1553.6
}
How can I access the count under easy under byDifficulty etc? The attempted code below doesn't work:
e.features[0].properties.statistics.runs.byActivity.downhill.byDifficulty.easy.count