[Vuejs]-Leaflet multiple markers json

0๐Ÿ‘

  • LMarker properties accepts latLng: object | array, just use a traversal method to build required format.

To solve your specific problem use the following snippet in your api request:

axios.get('http://api/api/v1/successgps').then((response) => {
  // this.markers = response.data.successgps;
  // var technicianlocation = '48.5206828,19.8217017';
  // console.log(technicianlocation.split(',')[0]);
  response.data.successgps.forEach((element) => {
    this.markers.push({
      technicianlocation: [element.technicianlocation.split(',')[0], element.technicianlocation.split(',')[1]],
    });
  });
});

Leave a comment