Excluding areas from routing



  • Hello guys,

    currently I am working on a navigation app using the QT Location API and the osm plugin. The app allows routing between two given coordinates. Additionally, certain areas can be excluded from the routing by using the addExcludedArea method of the RouteQuery type. Adding those areas works just fine, which I have checked by calling the excludedAreas property (a list of all saved areas). My problem here is, that those excluded areas are not considered when the route is calculated. In all my tests the calculated route leads right through the excluded area. So far I tried everything possible to find the reason for this and I am slowly considering that the method is not working properly.
    The geo rectangle which represents the excluded area is also defined correctly.
    I am using the following function to obtain the route:

        function routeDownload()
        {
            if (startCoordinate.isValid && endCoordinate.isValid){
            //clearing previous data
            routeQuery.clearExcludedAreas()
            routeQuery.clearWaypoints()
    
            //adding the excluded area
            routeQuery.addExcludedArea(region)
            console.debug(routeQuery.excludedAreas)
    
            //adding start and end coordinate
            routeQuery.addWaypoint(startCoordinate)
            routeQuery.addWaypoint(endCoordinate)
    
            //additional routing settings
            routeQuery.travelModes = RouteQuery.CarTravel
            routeQuery.routeOptimizations = RouteQuery.FastestRoute
    
            routeModel.update();
            }
        }
    

    I am very thankfull for every possible advice you could give me. This problem is keeping me busy for some time now.
    Also, can anyone confirm that the addExcludedArea method is actually working?



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