I use this query to get the latitude and longitude from node id in overpass API:
[out:json]; (
node(2314028892);
node(30223035);
node(268195434);
node(30223039);
); (._;>;); out;
I get this answer:
{
"version": 0.6,
"generator": "Overpass API 0.7.55.3 9da5e7ae",
"osm3s": {
"timestamp_osm_base": "2018-06-28T07:47:01Z",
"copyright": "The data included in this document is from www.openstreetmap.org. The data is made available under ODbL."
},
"elements": [
{
"type": "node",
"id": 30223035,
"lat": 52.2917680,
"lon": 10.5265481
},
{
"type": "node",
"id": 30223039,
"lat": 52.2894248,
"lon": 10.5268394
},
{
"type": "node",
"id": 268195434,
"lat": 52.2897618,
"lon": 10.5267852
},
{
"type": "node",
"id": 2314028892,
"lat": 52.2919739,
"lon": 10.5265271,
"tags": {
"bus": "yes",
"name": "Rühmer Weg",
"network": "VRB",
"operator": "Braunschweiger Verkehrs-GmbH",
"public_transport": "stop_position",
"ref": "464"
}
}
]
}
It seems that the elements in the answer have another order. I would like to now if I can get the answer in the same order as in the query. (First the node 2314028892, then 30223035, ... )
Anybody has any idea how could I get this done?
Use "out" after each query statement:
[out:json];
node(2314028892);out
node(30223035);out
node(268195434);out;
node(30223039);out;
For performance reasons, I would recommend to do this as post processing step on your end. You already know the correct sequence, so you can easily apply this to the query result. Also, you can specify multiple node id values in a single query:
[out:json]; node(id:2314028892, 30223035, 268195434, 30223039);out;
Side note: you can also leave out (._;>;);
in your query. It's not needed in case of nodes.