Overpass queries: finding duplicate values

Hi there. I’m trying to fix bus stops in my local area, and know some stops with duplicate ref= exist. I’ve been wondering if there’s any good way to run an overpass query to find these duplicate ref= values instead of manually having to sift through ~1000 stops to find them. Haven’t been able to find anything suitable here after a while of digging through the wiki page. Thanks!

1 Like

Perhaps overpass with csv output of the ref?

You can create a sorted list of that with a “sort” utility (available in most environments, including as an add-on to Windows) and a unique sorted list with “sort -u”. “diff” those two lists to get the duplicated ones.

“uniq -d” appeared to be enough after some preprocessing. Thanks for the tip, never would’ve thought that :slight_smile:

Run: Duplicate bus stops in London

// duplicate bus stops
node[highway=bus_stop]["naptan:AtcoCode"]({{bbox}});
for(t["naptan:AtcoCode"]) {
  if(count(nodes) > 1) {
    out tags center;
  }
}

Swap naptan:AtcoCode with ref.

1 Like

Is there a way to do that while also splitting values on delimiters (pipe and semicolon)? I know a bunch of stops here have multiple ref= values merged into one with those delimiters and I was able to preprocess to remove them, but I have never seen this part of overpass syntax before and have no clue what’s going on.

How about you provide some bus stop examples & what you’ve written so far.