Getting way/edge information by edgeId

Hello guys,

suppose that I established the mapping from OsmWayID to edgeId via overriding storeOsmWayID method of DataReader.

My question is how to work with edgeIds then, i.e. how to get the complete edge information using edgeId.

The goal is: for given set of OsmWayIds to find list of corresponding edgeIds (already done), then for the edgeIds obtain their lat/lons (and names if possible). Does any edge indexing method exist?

Please help me to resolve this problem, I suppose it can be don but don’t know how.

Thanks in advance,

Mira

I think you need this method:

EdgeIteratorState eis = graph.getEdgeIteratorState(edgeId, Integer.MIN_VALUE);
String name = eis.getName();
PointList points = eis.fetchWayGeometry(3);
// or graph.getNodeAccess().getLat(eis.getAdjNode());
// and eis.getBaseNode()

Other properties can be accessed if stored while the import. E.g. see this pull request: https://github.com/graphhopper/graphhopper/pull/730

Thanks for quick response. Just one question concerning the way data: how
can I define filtering of attributes of osm ways I want to incorporate, for
instance enable/disable instance hiking routes (like footway=yes,
bicycle=yes), third class roads etc…

Best regards,

Mira

There are two approaches: either you exclude these things while import, see e.g. FootFlagEncoder or you import all data and exclude those properties while routing with a custom weighting, see the pull request above