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

How to routing between 2 points, when i have only the addresse and Problem with drawing the way



  • Hi, I have problem with routing between 2 points. So, I have:

    
    
    ```RouteModel {
                        id: routeBetweenPoints
                        plugin: Plugin { name: "osm" }
                        query: RouteQuery {id: routeQuery }
                        Component.onCompleted: {
                        routeQuery.addWaypoint(QtPositioning.coordinate(51.318784,12.2773504 ));
                        routeQuery.addWaypoint(QtPositioning.coordinate(51.3117764,12.280909000000065 ));
                        update();
                        }
                }
    
    
    And I want route between 2 points, only by using the Addresse. 
    
    
    Button {
                        id: sendDataToItem
                        width: 100
                        height: 40
                        x: app_window.width / 2.7
                        text: "Send"
    
                    onClicked: {
                        fromAddress.country = txtFromAddressCountry.text;
                        fromAddress.city = txtFromAddressCity.text;
                        fromAddress.street = txtFromAddressStreet.text;
                        fromAddress.postalCode = txtFromAddressPostalCode.text;
    
                        toAddress.country = txtToAddressCountry.text;
                        toAddress.city = txtToAddressCity.text;
                        toAddress.street = txtToAddressStreet.text;
                        toAddress.postalCode = txtToAddressPostalCode.text;
    
                        //console.log(fromAddress);
                    }
                } //sendDataToItem
    

    But it doesn't work, beacouse i need to use the coordinates. And I don't know, how I can translate the adrdresse to coordinates. And of the another side, when I use all whta is inside onClicked, then i don't see th way which i draw

    
    
    RouteModel {
                        id: routeBetweenPoints
                        plugin: Plugin { name: "osm" }
                        query: RouteQuery {id: routeQuery }
                        Component.onCompleted: {
                        routeQuery.addWaypoint(QtPositioning.coordinate(51.318784,12.2773504 ));
                        routeQuery.addWaypoint(QtPositioning.coordinate(51.3117764,12.280909000000065 ));
                        update();
                        }
                }
    
    Know someone the resoult for this problem?

  • Moderators

    @DragonCoder said in How to routing between 2 points, when i have only the addresse and Problem with drawing the way:

    And I don't know, how I can translate the adrdresse to coordinates.

    see GeocodeModel


Log in to reply