NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

Wondering how to write an Overpass query to get only nodes with bus_stops from this query:

[out:json][timeout:25];
area[name="Radom"]->.searchArea;
( 
  relation["name"="8: Os. Wośniki => Kierzków"](area.searchArea);
);
out body;
>;
out skel qt;

in shortcut get bus stops by given area and relation.

asked 08 Jun '20, 09:46

macik1423's gravatar image

macik1423
16113
accept rate: 0%

edited 08 Jun '20, 10:14

Don't know much about Overpass QL, but if the relation is according to PTv2 it should have a role of platform, platform_exit_only or platform_entry_only. In the more traditional tagging they would have no role and you would have to look for nodes nodes in the relation that have the highway=bus_stop tag.

(08 Jun '20, 13:29) InsertUser

OK. We should get only the nodes belonging to the relation. I think it should be better like this :

[out:json][timeout:25];
area[name="Radom"]->.searchArea;

relation["name"="8: Os. Wośniki => Kierzków"](area.searchArea);
node(r)[highway=bus_stop];
out body qt;
permanent link

answered 09 Jun '20, 19:03

zorglubu's gravatar image

zorglubu
324126
accept rate: 15%

Thanks a lot! This is what I have been looking for. :D

(09 Jun '20, 21:29) macik1423

I have another question, is it possible to get order of nodes in data as same as relation in map? For example in this query

[out:json][timeout:25]; area[name="Radom"]->.searchArea; ( relation(5347191)(area.searchArea); node(r)[highway=bus_stop]; ); out geom;

order is random, not fit to relation on map.

(12 Dec '20, 11:03) macik1423
1

I am not sure, but I think that it is not possible directly with overpass. In my mind, the order is the one of the BDD. I am interested if somebody else has a better answer :-)

I have checked this request : [out:json][timeout:25]; relation(5347191); out meta;

The order seems to be the one shown in JOSM. Then you will need a post processing treatment.

(12 Dec '20, 11:27) zorglubu

Hello, Could you try :

[out:json][timeout:25];
area[name="Radom"]->.searchArea;

relation["name"="8: Os. Wośniki => Kierzków"](area.searchArea);

> -> .a;
node.a[highway=bus_stop];

out body qt;

This should extract the elements of the relation, and then only the nodes with the good tag.

permanent link

answered 08 Jun '20, 17:11

zorglubu's gravatar image

zorglubu
324126
accept rate: 15%

Thanks for respond! It's not quite what I expect. Query returns all bus stops (relation "8: Os. Wośniki => Kierzków" and reverse relation "8: Kierzków => Os. Wośniki"), I wanna bus stops from one direction.

(09 Jun '20, 10:14) macik1423
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×483
×128
×84
×10

question asked: 08 Jun '20, 09:46

question was seen: 1,681 times

last updated: 12 Dec '20, 11:48

NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum