Unable to get data from Overpass.turbo.eu

I am trying to extract data about all railway stations between 2 stations in Germany (say Fulda and Mottgers) and using query below but getting empty list. Any clue what is wrong
/////Query Begin ////////
[out:json] [timeout:60];
(
relation[“route”=“railway”][“name”~“Fulda.*Mottgers”];

)->.railway_route;

(node(r.railway_route)
[“railway”~“station|halt”];
);

out body;

;
out skel qt;
/////////////////////Query End////////////

//////////////////Output Begin/////////////
{
“version”: 0.6,
“generator”: “Overpass API 0.7.62.4 2390de5a”,
“osm3s”: {
“timestamp_osm_base”: “2024-12-03T08:16:00Z”,
“copyright”: “The data included in this document is from www.openstreetmap.org. The data is made available under ODbL.”
},
“elements”: [

]
}

////////////////Output End///////////////

Maybe I have misunderstood you, but is your intention to calculate a route between any two randomly chosen stations?

Something like what is done on this website, for example?

If so, Overpass can’t do that. It returns information about objects stored in the OSM database - it won’t calculate routes “on the fly”. Most randomly chosen station pairs won’t have route relations that start and end at exactly those stations, so you can’t pick two station names and expect to find a route relation with the relevant name.

Here are a couple of examples of route relations - as you can see, you would really need to already know the names to be able to search for these:
route=railway relation
route=train relation

Also note that route=train relations typically contain railway=stop as members, not railway=station. I don’t know much about railway=rail relations but they may only contain the tracks, not the stops/stations.

5 Likes

@Sanjay6G Please format code blocks as Markdown code blocks to make reading easier. Thank you.

1 Like

Thanks Alan, Yes, you are right and to calculate distance, I will be using either QGIS or any other hosted routing service. For finding stations, I think manual navigation through OpenRailwayMap will be best approach. Much appreciate the response again.