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

Show duplicated nodes via Overpass

2
1

How to show the duplicated nodes, such as this, via the Overpass (API, Turbo)?

asked 20 Dec '14, 20:34

chilin's gravatar image

chilin
61114
accept rate: 0%

edited 20 Dec '14, 20:37

As an aside, if you want to link to problem data that won't get accidentally fixed, you could use a link to a location via http://api06.dev.openstreetmap.org . That has a separate set of test data, and no one will fix your example problem by accident.

(21 Dec '14, 11:38) SomeoneElse ♦
1

@SomeoneElse: that probably won't work with overpass, as there's no instance pointing to the dev server I'm aware of. However, that's not a big issue. Just add [date:"2014-12-21T00:00:00Z"] to the top of the query to always reference that point in time.

(21 Dec '14, 12:02) mmd

Ok. Here's a permanent link to this place based on the due date.

(21 Dec '14, 20:06) chilin

One Answer:

6

As Overpass API is not the most common tool for this task, I will also mention a few more mainstream alternatives.

Option 1: Overpass API

This query will first determine all nodes in the current bounding box. For each node found, we will then start looking for some nodes at exactly the same location. The result will return all pairs of duplicate nodes found in the current bbox.

[bbox:{{bbox}}];
node;
foreach->.a(
    node(around.a:0)->.b;
    (.b; - .a);
    out meta;
);

Unfortunately, this approach is extremely slow with out meta; (NB: this seems to be a bug, I've created a Github issue for this). If you don't need metadata information, just replace out meta; by out; and you will get the response almost instantly.

Try it on overpass turbo: very slow (with metadata) and fast (without metadata)

alt text

Option 2:

I'd really recommend to also look at keep right! (analysis data is a few weeks old): see this example for a layer with multiple nodes on the same spot

Option 3:

In addition to that, JOSM validator will warn you regarding many unconnected nodes without physical characteristics in that area - and even fix them! That's probably the best way to go.

answered 20 Dec '14, 21:19

mmd's gravatar image

mmd
5.7k15388
accept rate: 37%

edited 21 Dec '14, 11:11

1

Thank you for such a detailed answer.

(20 Dec '14, 22:54) chilin

It should also be noted that multiple nodes on the same spot are not necessarily an error, and sometimes even required (e.g. in multi-level buildings).

(21 Dec '14, 11:37) Tordanik

For those coming here via a search, the above Overpass query requires an extra ';' after the '.a' variable:

(.b; - .a;);

(07 Jun '18, 12:47) DaveF

Source code available on GitHub .