From 10:00 CET Friday 22nd November we will adjust how the server works to deal with some recently reported problems. Therefore there may be a load problem, if you experience more problems than usual trying to access the forum then please PM AndyS or any of the moderators so they can inform me.


Showing rote data using OSM



  • I am trying to show a blue line between two points. I have followed examples given on youtube(https://www.youtube.com/watch?v=2u5wnrx6J-E) . Map is visible. But route is not visible at all . I have tried different coordinates. Please check the code. TIA

    import QtQuick 2.4
    import QtQuick.Controls 1.3
    import QtLocation 5.3
    import QtPositioning 5.3
    
    //silk board lat 12.917352466802262  long 77.62281109101559
    //CMRIT bus stop lat 12.9677261  long 77.71430729999997
    
    ApplicationWindow {
        visible: true
        width: 800
        height: 600
        title: qsTr("Hello World")
        color: "beige"
    
        Rectangle{
            anchors.fill: parent
            color: "gray"
            Plugin {
                id: mapPlugin
                preferred: "osm"
    
                // code here to choose the plugin as necessary
            }
    
            Map {
                id: map
                width: parent.width
                height: parent.height
    
                plugin: mapPlugin
    
    
                center {
                    latitude: 12.9172
                    longitude: 77.6228
                }
                MapQuickItem{
    
                }
                MapItemView{
                    model:routeModel
                    delegate: routeDelegate
    
                }
                Component{
                    id:routeDelegate
                    MapRoute{
                        route:routeData
                        line.color:"blue"
                        line.width: 3
                    }
                }
    
                zoomLevel: map.maximumZoomLevel
                Keys.onPressed: {
                    if (event.key === Qt.Key_Plus) {
                        map.zoomLevel++
                    } else if (event.key === Qt.Key_Minus) {
                        map.zoomLevel--
                    }
                }
                gesture.flickDeceleration: 3000
                gesture.enabled: true
                GeocodeModel{
                    plugin: mapPlugin
    
    
                }
                RouteModel{
                    id : routeModel
                    plugin: map.plugin
                    query: RouteQuery{
                        id:routeQ
                        travelModes: RouteQuery.PublicTransitTravel
    
                    }
                    Component.onCompleted: {
    //                    routeQ.addWaypoint(QtPositioning.coordinate(12.9172,77.6228));
    //                    routeQ.addWaypoint(QtPositioning.coordinate(12.9677261,77.6228));
    
                        routeQ.addWaypoint(QtPositioning.coordinate(12.917352466802262,77.62281109101559));
                        routeQ.addWaypoint(QtPositioning.coordinate(12.9677261,77.71430729999997));
                        update();
    
                    }
    
    
                }
            }
    
    
            Slider {
                id: sliderVertical1
                x: 714
                y: 187
                width: 22
                height: 202
                z:map.z+1
                orientation: Qt.Vertical
                minimumValue: map.minimumZoomLevel;
                maximumValue: map.maximumZoomLevel;
                value: maximumValue
                onValueChanged: {
                    map.zoomLevel=value
                }
            }
        }
    
    
    
        GroupBox {
            id: groupBox1
            x: 49
            y: 90
            width: 166
            height: 118
            title: qsTr("Settings")
    
            ComboBox {
                id: comboBox1
                x: 0
                y: 5
                width: 82
                model:ListModel{
                    ListElement { text: "SilkBoard to Agara"; color: "Yellow" }
                    ListElement { text: "SilkBoard to BTM"; color: "Green" }
                    ListElement { text: "SilkBoard to Bomasandra"; color: "Brown" }
                }
    
            }
    
            CheckBox {
                id: checkBox1
                x: 0
                y: 39
                text: qsTr("Petrol Pump")
            }
    
            CheckBox {
                id: checkBox2
                x: 0
                y: 68
                text: qsTr("Resturant")
            }
        }
    
    
    }
    
    
    
    • list item


  • Upgrading to 5.6 solved my issue.