# How to work with overpass ways in Python?

I would like to calculate the distance of some points to the nearest motorway, for that i would obviously need a series of vectors/lines etc. to represent the motorway.
On Overpass Turbo, the query

``````way["highway"~"motorway"]
(33.60615,-84.51173,33.92940,-84.22099);
out;
``````

returns various objects like this:

``````{
"type": "way",
"id": 41047668,
"nodes": [
68146293,
68146294
],
"tags": {
"bridge": "yes",
"destination": "Peachtree Industrial Boulevard",
"destination:ref": "GA 141 North",
"lanes": "1",
"layer": "1",
"oneway": "yes",
"surface": "concrete"
}
}
``````

How can I use this information to come to my final destination?
Does each node have its own coordinates and is there a straight vector between these nodes which is the motoway? Or should I somehow modify my query?
Does anyone have experience with such a problem and can share some knowledge?

• When trying your query it gets auto repaired to `way["highway"~"motorway"] (33.60615,-84.51173,33.92940,-84.22099); /*added by auto repair*/ (._;>;); /*end of auto repair*/ out;`. Also Im not sure if I understand your question. Why don't you just use the GeoJSON it returns? Also please clarify what you are trying to do using Python as you did not mention it in your question body. May 30, 2019 at 14:35
• Well, I would like to calculate between some points and vectors (the motorways), for that i need the coordinates of the vector representing the motorway. All That this query returns is a series of cryptic nodes and tags, no coordinates... May 30, 2019 at 14:38
• Working fine for me on overpass-turbo.eu/s/JwZ May 30, 2019 at 15:56
• I only seem to receive coordinates for nodes of junctions, not actual motorways (when you scroll further down), which still only have nodes depicted like this "<nd ref="67549955"/>" May 30, 2019 at 16:09

Ways are composed of nodes as you surmise. You can get geometry by modifying the `out` call (see the documentation):