Why is JOSM Overpass wizard so different from Overpass Turbo?

When attempting to download a relation in JOSM so I can just add some tags (Wikidata and Wikipedia) (because ID won’t let me edit due to the zoom level), I just want to download the relation, since all I’m changing is some tags. I put the following into the wizard “type:relation id:7425402” and I end up with the following query:

[out:xml][timeout:90][bbox:{{bbox}}];
(
  relation/*id=7425402-7425402*/;
);
(._;>;);
out meta;

However, putting the same request into the overpass turbo wizard returns the following:

/*
This has been generated by the overpass-turbo wizard.
The original search was:
“type:relation AND id:7425402”
*/
[out:json][timeout:25];
// gather results
relation(7425402)({{bbox}});
// print results
out geom;

Of course, I need to change it from out geom; to out meta; and out:json to out:xml to make it work in JOSM, but the results are significantly different. The JOSM query returns around 100mb of data (according to Overpass Turbo), including all kinds of roads, townships, counties, and possibly more, while the Overpass Turbo query returns what I expected, just the requested relation.

Should I just be making all of my queries in Overpass Turbo and then converting for JOSM or is there some reason why the JOSM Overpass query downloads so much more data than what I asked for?

/*id=7425402-7425402*/ means it’s commented-out, meaning relation; is executed in [bbox:{{bbox}}] to get everything being related in view. This seems a bug. There were some other reported in recent months.

2 Likes

Well it seems as if JOSM doesn’t handle the id:7425402 correctly and inserts a comment instead, so you simply get all relations in the bounding box.

That’s a bit surprising, not to say a bug (but all of this is not wonderfully documented to start with), and you probably should simply open an issue on josm.openstreetmap.de

That said, there are AFAIK three independent implementations of converting JOSM search/filter grammar in to overpass queries, the overpass turbo one, the JOSM one and mine, and they all differ slightly in what they produce, which in the end is mainly due to how they will be typically used (and the JOSM search grammar being rather idiosyncratic leaving lots of room for interpretation).

Mine is naturally the best :grinning:

PS: just for the record this is what I produce for type:relation id:7425402 inview

[out:xml][timeout:90];
relation(7425402)({{bbox}});
(._;>;);
out meta;

Doc: https://vespucci.io/tutorials/object_search/

2 Likes

As a non-programmer, it seems a bug for not producing [~"id"~"7425402"] if id: isn’t recognized. I tried an arbitrary xy:7425402 , which generated [~"xy"~"7425402"] logically. So something appears to have gone wrong when attempting to convert to (id:7425402)

For what its worth, I have never had luck with any of the wizards outside of the most basic search, and often it ends up like your results.

However I wanted to point out a few alternatives for you.

JOSM: File → Download Object. Select relation and put your id 7425402. Edit as usual.

Level0: In the URL/ID box, put r7425402. Hit enter, edit as usual.

Use an LLM: You don’t always hit gold on the first ask, but it can help you get there for basic requests: Give me the complete overpass query to use in the JOSM editor to get a relation with the id 7425402. Please explain.

Which does work.

2 Likes

Just to add one more - I usually end up taking the middle bit (in this case relation(7425402)({{bbox}});) of an Overpass Turbo query from Taginfo and using it within one of Josm’s example queries. I neither know nor care what all of Overpass’ squiggles mean, but do trust Taginfo to produce something sensible for the middle bit.

1 Like

Just a further note: the JOSM and my implementation are geared towards generating a query that will return data that you can edit.

The overpass turbo query will not generate valid osm xml even if you switch to xml output as is, because it doesn’t recurse and retrieve the actual member elements. That’s completely OK if you simply want the geometry which is the typical use case for overpass-turbo, but naturally not for an editor.

3 Likes

In this case, the original question only wants to edit tags, so it’s acceptable, similar to Level0. Can always right-click to download (incomplete) members. The out; is automatically fixed by JOSM to be out meta;

Sure but the original question is why are they different and recursing vs. not recursing is one of the differences.

2 Likes

You should just use the search box in OSM ID and write=

r7425402

Then edit the key=value.