Routing graph builder

20 views
Skip to first unread message

Александр Гурьянов

unread,
Jun 5, 2014, 9:53:50 PM6/5/14
to mona...@googlegroups.com
Hi. I try to write simple programm to building graph for monav (like osmimport does). I start with 10 GPSCoordinates of one single edge.

int pointsCount = 10;
GPSCoordinate points[] = { ...  };

I try to build graph with one edge started at points[0] ended with points[pointCount -1] and path points[ 1 .. pointsCount - 2]. My code is:
bool GeoImporter::GetRoutingEdges(std::vector<RoutingEdge>* data) {
        RoutingEdge edge;

        edge.source = 0;
        edge.target = 1;

        edge.edgeIDAtSource = 0; //???
        edge.edgeIDAtTarget = 0; //???

        edge.distance = 1;

        edge.bidirectional = false;
        edge.branchingPossible = false;

        edge.nameID = 0;
        edge.type = 0;

        edge.pathID = 0;
        edge.pathLength = pointsCount - 2;

        data->push_back(edge);
        return true;
}

bool GeoImporter::GetRoutingEdgePaths(std::vector<RoutingNode>* data) {
    for (int i = 1; i < pointsCount - 2; ++i) {
        RoutingNode node;
        node.coordinate = UnsignedCoordinate(points[i]);
        data->push_back(node);
    }
    return true;
}

bool GeoImporter::GetRoutingNodes(std::vector<RoutingNode>* data) {
    {
        RoutingNode node;
        node.coordinate = UnsignedCoordinate(points[0]);
        data->push_back(node);
    }

    {
        RoutingNode node;
        node.coordinate = UnsignedCoordinate(points[pointsCount - 1]);
        data->push_back(node);
    }

    return true;
}

But when i build this graph monav can`t find any way beetwen start and end point. When i change this code and rebuild graph as sequence of edges (one edge for 2 points) then monav start finding way but i need one ege. Also i don`t understand what edgeIDAtSource/Target means.

Александр Гурьянов

unread,
Jun 6, 2014, 12:02:19 AM6/6/14
to mona...@googlegroups.com
When i mark edge as bidirectional then monav finds way throught this edge. May be there are bug with finding way if it starts and ends on a single edge.
Reply all
Reply to author
Forward
0 new messages