Export shapefile from GH graph

Is there a easy/simple way to create/export shapefile from GH Graph? Just the links (with some tag info) is sufficient.

I actually thought of getting the node coordinates and then list of all nodes for each edge in the base graph.
Is it a logical way to export the graph or there is some other way to do that? I was able to get some info of the edges with

Graph graph = hopper.getBaseGraph();
AllEdgesIterator allEdges = graph.getAllEdges();

while (allEdges.next()) {
int baseNode = allEdges.getBaseNode();
int adjNode = allEdges.getAdjNode();

But how can I get lat/long of each node in the base graph?
Also, how to copy the way geometry?

To get the coordinates of the base/adjNode you do:

int lat = graph.getNodeAccess().getLat(baseNode);
int lon = graph.getNodeAccess().getLon(baseNode);

To get the geometry you do:

edge.fetchWayGeometry(FetchMode.ALL); // includes the coordinates of the base/adjNode, see other FetchModes if you only need the inner points
1 Like

Thank you so much. I created a shapefile from the graph.

1 Like