[SOLVED] [JOSM] Query works in OverpassTurbo, but fails in JOSM

Hello,

This works fine in Overpass Turbo:


[out:json][timeout:25];

rel(123);map_to_area -> .searchArea;

(
node["highway"="traffic_signals"](area.searchArea);
way["highway"="traffic_signals"](area.searchArea);
relation["highway"="traffic_signals"](area.searchArea);
);

out body;
>;
out skel qt;

But it fails when copy/pasted into JOSM (File > Download from Overpass API):


rel(123);map_to_area -> .searchArea;

(
node["highway"="traffic_signals"](area.searchArea);
way["highway"="traffic_signals"](area.searchArea);
relation["highway"="traffic_signals"](area.searchArea);
);

out body;
>;
out skel qt;

What’s wrong with the query?

Thank you.

There are multiple issues with your query:

  • JOSM requires XML format, JSON format will not work
  • JOSM requires metadata, out body; >; out skel qt; will not do as they don’t include object version numbers. Use (._;>;);out meta; instead

In general it’s probably best to use Export → load data into an OSM editor: JOSM and have your query automatically fixed.

Thanks much.

I agree, but I needed to download a subset of the data from OSM, not everything in a given area, hence my using a query to Overpass.

The method mmd describes will also only load the data defined by the Overpass Query. You do not have to load any other data with JOSM in that case.

Maybe not clear enough, “Export → load data into an OSM editor: JOSM” refers to overpass turbo, not openstreetmap.org. Hence, JOSM will download exactly the same data as you get in overpass turbo via your query. in fact, your Overpass query will be transferred to JOSM and run again on the JOSM side.

Please also check the overpass turbo documentation for further details: http://wiki.openstreetmap.org/wiki/Overpass_turbo#Exporting_Results