My current challenge involves working with a JSON file containing an array of states and a sub-array of corresponding latitude (lat) and longitude (lng) values.
After looping through the states and points to build 50 polygons, I now need to center and zoom in on a state when it is clicked. I realized I could potentially reloop through the points to add bounds, but when I display the polygon in the console, I can see the points by clicking through the values.
Is there a way to access these points without reiterating through them? The points are already associated with a polygon, which is linked to a state.
When I attempt to log console.log(newpoly.latLngs);
, the output looks cumbersome and messy.
Kf
->b: Array[1]
->0: Kf
->b: Array[5]
->0: Q
Xa: 41.0037
Ya: -104.05560000000003
__proto__: Q
1: Q
Xa: 44.9949
Ya: -104.0584
__proto__: Q
2: Q
Xa: 44.9998
Ya: -111.0539
__proto__: Q
3: Q
Xa: 40.9986
Ya: -111.04570000000001
__proto__: Q
4: Q
Xa: 41.0006
Ya: -104.05560000000003
I apologize for the unclear formatting.
Is there a way to access the last array of the latLng points without adding another loop for the bounds?
Thank you.