Run query in overpass-turbo with id's get from file

Hallo,

I’d like to run such a query in overpass-turbo:

“id: 11111 or id:22222 or id:3333 or … or id:xxxx”

or like this "id in (1111,2222,3333, … xxxx) with a lot of id’s, therefore I’d like read these id’s from file.

So: if I have a file which contains OSM object id’s (i.e. a.csv = comma or semicolon separated text) how can I read this file in order to query all objects with the id’s read from the file.
Thanks in advance,

I don’t think that Overpass Turbo/API supports reading from an id file, there are probably better tools for this, like Osmium Tool.

But to understand the context: where are those object ids coming from?

1 Like

Found on Stackxechange: openstreetmap - Overpass API query to retrieve way ids given a list of node ids - Geographic Information Systems Stack Exchange

node(id:384845483,3831831361,2628299968);
way(bn);
out geom;

[…] way(bn) gives you the parent ways for nodes in the inputset

Is that good solution for you?

2 Likes

Hi Ikonor,
I dont’t know whether is it supported I only read but didn’t find example.
I try Osmium tool, thank you for the idea.

Regards,

Hi Marek-M,

It is not reading the data (id’s) from file, but compatible solution for my problem.
Thank you.

Regards,

The use case of that question is:

Given a list of node ids returned by an OSRM map matching query I am trying to find a list of corresponding way ids

Route Annotator was made exactly for that purpose and might be a better alternative than Overpass, at least for large scale uses (maybe also for this case).

That’s why I asked for context, as what is the best solution depends on the use case. There might be good reasons, but querying lots of ids from an online service like Overpass sounds like there is something wrong in the process to me.

You can also use this tool if you need to get XML data. CSV file must have headers element and id:

  1. Copy content from CSV or spreadsheet to Input 1
  2. Click on convert button
  3. Toggle Get OSM data from Overpass API
  4. Get XML from Input 2

But if you need more flexibility then include the list of id’s in the query as @Marek-M already showed:

[out:xml];
(
node(id:111,112,113);
way(id:222,223);
relation(id:333,334);
);
out meta;