Track GPS route in QML and remove previous marker
-
Hi, I'm noob to QT/QML sorry if the question is too basic.
Right now I can represent the position on a map by getting the GPS coordinates. Once these coordinates are obtained, they are represented with a marker, but the previous one is not eliminated, rather they are accumulated. I think QT has some predefined way to do this but I haven't found it.
function addMarker(lat, lng) { var markerItem= comp_Marker.createObject(window, {coordinate: QtPositioning.coordinate(lat, lng)}) mapView.addMapItem(markerItem) } . . . Component { id: mapMarker MapQuickItem { id: marker_Imgae anchorPoint.x: image_marker.width/5 anchorPoint.y: image_marker.height/2 coordinate: position sourceItem: Image { id: image_marker source: "https://cdn4.iconfinder.com/data/icons/small-n-flat/24/map-marker-512.png" } } }
On the other hand, I am trying to trace the route that the GPS device is taking without success. I'm looking for information soure RouteMap and MapPolyline but I'm not sure if it's the right way.
https://doc.qt.io/qt-5/qml-qtlocation-maproute.html
https://doc.qt.io/qt-5/qml-qtlocation-mappolyline.htmlThank you!
-
Hello, as a clarification in case you have any ideas, this is what I try to achieve:
https://www.youtube.com/watch?v=-OcEpGMBNzg