How to draw routes on the map?



  • Hello everyone!!
    I want to display Map and draw lines on it.

    I have qml code but routes aren't displayed.
    Does anybody know how to draw?

    My code:
    ```

    Item
    {
        Map
        {
        id: map
        anchors.fill: parent
        plugin: Plugin{name: "MBTiles"}
        center: QtPositioning.coordinate(42.25277166666667, 42.68047166666667)
        zoomLevel: 30
    
        MapQuickItem
        {
            coordinate: QtPositioning.coordinate(42.25277166666667, 42.68047166666667)
            sourceItem: Image
            {
                id: image
                source: "qrc:/new/m.png"
            }
        }
        MapItemView
        {
            model: routeModel
            delegate: Component
            {
                MapRoute
                {
                    route: route
                    line.color: "blue"
                    line.width: 5
                }
            }
        }
    }
    
    RouteModel
    {
        id: routeModel
        plugin: map.plugin
        query: RouteQuery {id: routeQuery}
        Component.onCompleted:
        {
            routeQuery.addWaypoint(QtPositioning.coordinate(42.25277166666667, 42.70047166666667))
            routeQuery.addWaypoint(QtPositioning.coordinate(42.25277166666667, 42.68047166666667))
            update();
        }
    }
    

    }


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.