Without digging too deep into the code - do you add each point as a separate layer or all points go as a vector into a single layer? So, whether you end up having 7000 layers or just few with many points?
//Start new trackline here //Create fresh temp line array vLineArray = []; //Write first coordinate of new track segment to line array vLineArray.push(coordinate); //Save that to global array vTrackLinePoints = vLineArray; sTrackLine = "lineTrack" + iPausePositionsIndex.toString(); //We have to create a track line here. map.addSourceLine(sTrackLine, vTrackLinePoints) map.addLayer("layerTrack" + iPausePositionsIndex.toString(), { "type": "line", "source": sTrackLine }) map.setLayoutProperty("layerTrack" + iPausePositionsIndex.toString(), "line-join", "round"); map.setLayoutProperty("layerTrack" + iPausePositionsIndex.toString(), "line-cap", "round"); map.setPaintProperty("layerTrack" + iPausePositionsIndex.toString(), "line-color", "red"); map.setPaintProperty("layerTrack" + iPausePositionsIndex.toString(), "line-width", 2.0);
updateSourceLine
//Create temp line array and set current points array to it. Must use a JS array here necause QML arrays don't allow for push! vLineArray = vTrackLinePoints; //Write first coordinate to line array vLineArray.push(coordinate); //Save that to global array vTrackLinePoints = vLineArray; map.updateSourceLine(sTrackLine, vTrackLinePoints);