I have a variable created in leaflet and I need to extract a part of inside data that are gps coordinates, in order to use separately
This is my var and how it is generatared
var track = new L.GPX(‘tracce_gpx/Subit(via Porzûs)_Attimis.gpx’, {async: true, display_wpt:false, color: ‘#a539a8’,opacity:0.6,weight:6}).addTo(Video);
with “console.log(track);”
in browser console I obtain:
i {options: {…}, _gpx: 'tracce_gpx/Subit(via Porzûs)_Attimis.gpx', _layers: {…}, _initHooksCalled: true, _events: {…}, …}
options
:
{async: true, display_wpt: false, color: '#a539a8', opacity: 0.6, weight: 6}
_events
:
{click: Array(1)}
_gpx
:
"tracce_gpx/Subit(via Porzûs)_Attimis.gpx"
_initHooksCalled
:
true
_layers
:
126
:
i
options
:
{async: true, display_wpt: false, color: '#a539a8', opacity: 0.6, weight: 6}
_bounds
:
R {_southWest: D, _northEast: D}
_eventParents
:
{125: i}
_events
:
{click: Array(1), keypress: Array(1), remove: Array(1), move: Array(1)}
_initHooksCalled
:
true
_latlngs
:
Array(588)
[0 … 99]
[100 … 199]
[200 … 299]
[300 … 399]
[400 … 499]
[500 … 587]
length
:
588
[[Prototype]]
:
Array(0)
_leaflet_id
:
126
_popup
:
i {options: {…}, _source: i, _initHooksCalled: true, _content: '<p>12.0 km</p>'}
_popupHandlersAdded
:
true
[[Prototype]]
:
i
[[Prototype]]
:
Object
_leaflet_id
:
125
[[Prototype]]
:
i
What a need is to extract and assign data from (_latlngs : ) to a new variable
this is a part of a more complicated question posted here:
How to create leaflet polyline, after loading Gpx track, with different colors
thanks for any suggestion