Component overview

From OpenStreetMap Wiki
Jump to: navigation, search
For reusable components for developing websites or applications, see Frameworks.
Available languages — Component overview
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 norsk nynorsk occitan Oromoo oʻzbekcha/ўзбекча Plattdüütsch polski português 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 беларуская български қазақша македонски монгол русский тоҷикӣ українська Ελληνικά Հայերեն ქართული नेपाली मराठी हिन्दी অসমীয়া বাংলা ਪੰਜਾਬੀ ગુજરાતી ଓଡ଼ିଆ தமிழ் తెలుగు ಕನ್ನಡ മലയാളം සිංහල ไทย မြန်မာဘာသာ ລາວ ភាសាខ្មែរ ⵜⴰⵎⴰⵣⵉⵖⵜ አማርኛ 한국어 日本語 中文(简体)‎ 吴语 粵語 中文(繁體)‎ ייִדיש עברית اردو العربية پښتو سنڌي فارسی ދިވެހިބަސް

This page is to give Developers a technical overview of logical system/components of OpenStreetMap.


OSM Components.svg


The database holds all the map data in the form of nodes, relations, and ways. See Database schema. The database software used is PostgreSQL.


The OSM API is a REST web service interface for reading and writing to the database i.e. XML over HTTP, with use of simple URLs for object access, and standard HTTP response codes.

Other OSM components access the database via this interface. It is also available to the outside internet.

The API logic is all part of the same Ruby on Rails application which powers the OSM front end website.

OSM Front End

The web front end is a Ruby on Rails application (see The Rails Port), with views and models sitting alongside those of the XML API. As is standard for a Rails app, it uses a direct connection to the database (not calling the API - this connectivity is not shown on the diagram above).

The website's main function is to display the Slippy Map (view tab), and the online editor iD (edit tab), but it also deals with logging in, registering, user pages, GPS traces, user diaries, data browser and other raw data 'browse' views, and changeset history views.

Slippy Map

See Slippy Map. The main map appearing on the homepage is a Javascript interface letting you zoom and pan ("slippy" draggable panning). What happens is, the website (the 'index' view of the rails app) invokes Leaflet. As it does so, it passes in a latitude and longitude based on the users last viewed location or URL params. Leaflet does its client-side Javascript magic, to figure out which 'tile' images to fetch from the tile server.


iD is the online editor appearing on the 'edit' tab. Again the Rails app has a view for the 'edit' tab. iD is written in javascript. It can be embedded on other websites, to allow a configurable customised editing experience from elsewhere on the web. The predecessor Potlatch 2 (uses flash) is still available on the edit tab drop-down.

Tiles and tile rendering

There is an ongoing process of fetching map data via the API, and rendering maps as raster images known as tiles. Many new tiles need to be rendered to achieve full (global) coverage, but also updates to the underlying map data will mean that existing tiles need to be re-rendered.


Mapnik is a rendering system which powers the display which is currently the Slippy Map default. The rendering process runs on the 'tile' server, and Mapnik tile images are served from that machine. This renderer takes its data from a postgres database (also on the tile server). This database holds data in the format expected by Mapnik, using PostGIS extensions. This is an entirely different format to the database used on the core OSM database server. The mapnik database is populated by running an osm2pgsql script on minutely diffs.


As mentioned above, we use rendering software called Mapnik to create raster images for the slippy map tiles. Renderers can also be used on an ad-hoc basis for creating map images from our data. There's limitless potential to develop new ways of rendering our data. See Renderers.


Along with the edit tab on the website (iD) there are other tools, which allow you to edit the OSM data via the API. The most popular desktop editor is JOSM. See Editors for a list. The API allows authentication via OAuth which involves the user granting permissions to the third party software, without handing over OpenStreetMap login credentials. Editor software can take the form of a web-based application (flash, javascript, or something more simple), a desktop application, or (increasingly) a mobile app.