Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

How do I move my map markers in realtime?



  • hi everyone,
    I work on qtlocation map and I want update my location in realtime. I already set my updateInterval: 1 (0.001 sec) but MapQuickItem still moves too late.
    is there a way about that how can i move my marker in realtime? any suggestion about it is very useful for me.
    thanks.

    this my qml:

    PositionSource {
        id: ps
        updateInterval: 1
        active: true
        onPositionChanged: {
            console.log(position.coordinate);
        }
    }
    
    Map {
        id: map
        anchors.fill: parent
    
        plugin: Plugin {
            name: "mapboxgl"
    
            PluginParameter {
                name: "mapboxgl.access_token"
                value: "my_token"
            }
    
            PluginParameter {
                name: "mapboxgl.mapping.additional_style_urls"
                value: "Urls"
            }
        }
    
        MapQuickItem {
            zoomLevel: map.zoomLevel
    
            sourceItem: Image {
                id: carMarker
                source: "../images/circle.png"
            }
    
            coordinate: ps.position.coordinate
            anchorPoint.x: carMarker.width / 2
            anchorPoint.y: carMarker.height / 2
        }
    }
    

    and this the result:
    https://drive.google.com/file/d/1lLMuyWX4WQYw-L4jdx-sq-xstkjVRyCl/view?usp=sharing


Log in to reply