This is a static archive of our old OpenStreetMap Help Site. Please post any new questions and answers at community.osm.org.

Best way to query train lines?

0

Hello,

I'd like to get all the disused train lines in France.

The following query can time-out, and iOT isn't happy if I run it again ("Check your quota"):

[out:json][timeout:25];

//Metropolitan France 1403916
rel(1403916);
map_to_area -> .searchArea;

(
  way[railway~"(disused|abandoned)"](area.searchArea);
);

out geom;

Is there a better way, possibly using the command-line?

Thank you.

asked 25 Aug '21, 18:44

Shohreh's gravatar image

Shohreh
85131318
accept rate: 0%


2 Answers:

1

If you're after actual closed railways the popular tags are:

area(3600008640);
way[~"(disused:railway|abandoned:railway)"~"^rail$"](area); 
out geom;

I've used a smaller relation for ease of explanation. For the whole of France & Corsica use area(3601403916); (~20mb)

If you're specifically after tags which aren't the above then you'll almost certainly need to split your search into smaller areas as using the 'railway' key searched all values for it, which returns quite a bit more data than just 'rail'.

answered 26 Aug '21, 15:38

DaveF's gravatar image

DaveF
3.3k8498133
accept rate: 16%

Thanks much for the syntax.

(26 Aug '21, 17:26) Shohreh

0

Addendum to original answer:

You may get away with calling this just once, for the whole of the country (~40mb). The Regex '^' & '$' means the search has to start & end with those words so, in fact, it's only searching for whole words.

area(3601403916);
way[railway~"^(disused|abandoned)$"](area);
out geom;

answered 26 Aug '21, 18:01

DaveF's gravatar image

DaveF
3.3k8498133
accept rate: 16%

I'll give it a try, and see if OT doesn't complain with my querying too much data.

(26 Aug '21, 18:11) Shohreh

Source code available on GitHub .