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 · Basa Sunda · Baso Minangkabau · bosanski · brezhoneg · català · čeština · corsu · 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 · română · shqip · slovenčina · slovenščina · Soomaaliga · suomi · svenska · Tagalog · Tiếng Việt · Türkçe · Vahcuengh · vèneto · Wolof · Yorùbá · Zazaki · српски / srpski · беларуская · български · қазақша · македонски · монгол · русский · тоҷикӣ · українська · Ελληνικά · Հայերեն · ქართული · नेपाली · मराठी · हिन्दी · भोजपुरी · অসমীয়া · বাংলা · ਪੰਜਾਬੀ · ગુજરાતી · ଓଡ଼ିଆ · தமிழ் · తెలుగు · ಕನ್ನಡ · മലയാളം · සිංහල · བོད་ཡིག · ไทย · မြန်မာဘာသာ · ລາວ · ភាសាខ្មែរ · ⵜⴰⵎⴰⵣⵉⵖⵜ ⵜⴰⵏⴰⵡⴰⵢⵜ‎ · አማርኛ · 한국어 · 日本語 · 中文(简体)‎ · 中文(繁體)‎ · 吴语 · 粵語 · ייִדיש · עברית · اردو · العربية · پښتو · سنڌي · فارسی · ދިވެހިބަސް
Overpass API logo.svg
Overpass API · Language reference · Language guide · Technical terms · Areas · Query examples · Advanced examples · Sparse Editing · Permanent ID · FAQ · more · Web site
Servers status · Versions · Development · Technical design · Installation · XAPI compatibility layer · Public transport sketch lines · Applications · Source code and issues
Overpass turbo · Wizard · Overpass turbo shortcuts · MapCSS stylesheets · Export to GeoJSON · more · Source code and issues · Web site

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. 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 set the standard OSM map in black/white as a wallpaper in JOSM. Then we download the filtered data.


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 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 data > 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];
out meta;

The syntax is explained in the next section below. The bounding box will be set by JOSM by including the [bbox:{{bbox}}] predicate. 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];>;);
out meta;

All public transport related data:

( way[highway];>;
out meta;