Overpass API/Sparse Editing

From OpenStreetMap Wiki
Jump to: navigation, search
Available languages — Overpass API/Sparse Editing
· Afrikaans · Alemannisch · aragonés · asturianu · azərbaycanca · Bahasa Indonesia · Bahasa Melayu · Bân-lâm-gú · Basa Jawa · Baso Minangkabau · bosanski · brezhoneg · català · čeština · dansk · Deutsch · eesti · English · español · Esperanto · estremeñu · euskara · français · Frysk · Gaeilge · Gàidhlig · galego · Hausa · hrvatski · Igbo · interlingua · Interlingue · isiXhosa · isiZulu · íslenska · italiano · Kiswahili · Kreyòl ayisyen · kréyòl gwadloupéyen · Kurdî · latviešu · Lëtzebuergesch · lietuvių · magyar · Malagasy · Malti · Nederlands · Nedersaksies · norsk bokmål · norsk nynorsk · occitan · Oromoo · oʻzbekcha/ўзбекча · Plattdüütsch · polski · português · português do Brasil · română · shqip · slovenčina · slovenščina · Soomaaliga · suomi · svenska · Tiếng Việt · Türkçe · Vahcuengh · vèneto · Wolof · Yorùbá · Zazaki · српски / srpski · беларуская · български · қазақша · македонски · монгол · русский · тоҷикӣ · українська · Ελληνικά · Հայերեն · ქართული · नेपाली · मराठी · हिन्दी · অসমীয়া · বাংলা · ਪੰਜਾਬੀ · ગુજરાતી · ଓଡ଼ିଆ · தமிழ் · తెలుగు · ಕನ್ನಡ · മലയാളം · සිංහල · ไทย · မြန်မာဘာသာ · ລາວ · ភាសាខ្មែរ · ⵜⴰⵎⴰⵣⵉⵖⵜ · አማርኛ · 한국어 · 日本語 · 中文(简体)‎ · 吴语 · 粵語 · 中文(繁體)‎ · ייִדיש · עברית · اردو · العربية · پښتو · سنڌي · فارسی · ދިވެހިބަސް
Overpass turbo · Overpass API · Language reference · Query examples · Language Guide · Advanced examples · Sparse Editing · FAQ · MapCSS · more: Overpass turbo · Overpass API

If the OSM data are highly dense in a certain area then it becomes more and more difficult to do perform edits. By combining JOSM and Overpass API you can overcome this: The plugin mirrored_download simplifies the download of the necessary data. Working in this way comes close to the concept of "layers" in classical GIS systems. Caution: Editing this way requires more care than usual. Please read below.

As an example, we want to check which shops in Bonn already have a "wheelmap" tag and add it if applicable.

For this purpose we install in JOSM the plugin "mirrored_download" and as a wallpaper the standard OSM map in black/white. Then we download the filtered data.

Precautions

Editing in this way requires more diligence than usual: Changing a geometry might mess up an invisible object. Also, nodes can belong to not-downloaded ways, and editing could this way affect unknown ways. This problem otherwise only appears at the brim of the bounding box in JOSM. For these reasons: Please do neither delete nodes nor move them around. Changing tags or splitting and joining of ways is on the other hand safe, and this covers a couple of interesting editing scenarios.

Install mirrored_download

You need to do this and the following step only once because JOSM stores locally both settings and plugins.

Select "Edit > Preferences ...".

Select the power plug in the panel on the left.

Select "Download list"

Type "mirr" into the Search and select then the leftover entry "mirrored_download".

"OK". "Restart" and wait for the restart.

Install the background wallpaper

Select "Edit > Preferences ...".

Select "TMS/WMS", the lowest entry in the panel on the left.

Select from "Available default entries" the entry "OpenStreetMap (Mapnik Black & White)" and click "Activate", then "OK".

Select then "Imagery > OpenStreetMap (Mapnik Black & White)". You see a lighter grey. The real map will appear after we have chosen a bounding box in the next step. You can ignore the warning about misalignment because the OSM base map is by design the same way aligned as the data it is made from.

Download data

Select "File > Download from Overpass API".

Choose you desired bounding box from the "Slippy Map". You can zoom out and in with the mouse wheel. You can pan around by keeping the right mouse button pressed and dragging. You can choose a bounding box by dragging with pressed left mouse button.

Paste the following query to "Overpass query". We use here:

( node[shop];
  way[shop];>;
  rel[shop];>;);
(._;rel(bn););
(._;rel(bw););
(._;rel(br););
out meta;

The syntax is explained in the next section below. The bounding box will be set automatically by JOSM. The crucial thing is that we download here also relations and refer to the downloaded objects such that JOSM can take care of them when we edit.

Click "Download" and wait until the download has completed. During the tests this has taken 5 to 15 seconds.

Josm shops in bonn.png

Please keep the precautions in mind. Or use it as a flexible read-only view for OSM objects of chosen category.

More useful queries

The entire street grid:

( way[highway];>;);
(._;rel(bn););
(._;rel(bw););
(._;rel(br););
out meta;

All public transport related data:

( way[highway];>;
  way[railway];>;
  node[public_transport];
  node[highway=bus_stop];);
(._;rel(bn););
(._;rel(bw););
(._;rel(br););
out meta;