OSM edge id with route api

Hi

I am pretty new to coding and using api. I have a very novice question.
I want to get some routes with the original osm id of the edges and also to enable elevations as the roads should have bridges and tunnels. I tried to find solution in previous discussion but don’t understand how exactly I can use them. (e.g., OSM max_speed and osm_id). I found an example which made me interested using graphhopper (https://medium.com/@tjukanov/animated-routes-with-qgis-9377c1f16021). I downloaded a pbf file (following this example) for DC to use as network.

I ran (java -Dgraphhopper.datareader.file=district-of-columbia-latest.osm.pbf -jar *.jar server config-example.yml) in terminal and used the following code.

  • urlStart = 'http://localhost:8989/route?’*

  • point = ‘point=’*

  • urlEnd = ‘&type=gpx&vehicle=car&weighting=fastest&points_encoded=false’*
    separator = ‘%2C’

  • req=urlStart + point + ‘38.906196’ + separator + ‘-77.069619’ + ‘&’ + point +‘38.976896’ + separator + ‘77.078’ + urlEnd*

  • try: *

  •    resp=urllib.request.urlopen(req)*
    
  •    gpxData=str(resp.read(),'utf-8')*
    
  •    fileName='dc_'*
    
  •    saveFile=open('test_gpx_files/dc_.gpx','w')   *
    
  •    saveFile.write(gpxData)*
    
  •    saveFile.close()*
    

I get something like this:

GraphHopper GPX2020-01-30T21:18:42Z
continue onto M Street Northwestgh:distance1694.6</gh:distance>gh:time90196</gh:time>gh:directionW</gh:direction>gh:azimuth269.11</gh:azimuth>gh:sign0</gh:sign>…
GraphHopper Track
lat=“38.905215” lon="-77.059701" time>2020-01-30T21:18:42Z…

Q. I disable points_encoding to get the elevation but where is the elevation information?
Q. how to get original OSM id for each edges of a route?

Thank you so much.
Subrina

Powered by Discourse