Component overview

From OpenStreetMap Wiki
(Redirected from Components)
Jump to: navigation, search
Available languages

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

Diagram

OSM Components.png

Database

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

API

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 Potlatch ("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 openstreetmap.org 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.

Potlatch

Potlatch is the online editor appearing on the 'edit' tab. Again the Rails app has a view for the 'edit' tab. Potlatch is a Flash object embedded on the web page. It is written in ActionScript. The Potlatch editor can be embedded on other websites, to allow a configurable customised editing experience from elsewhere on the web.

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

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.

Renderers

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.

Editors

Along with the edit tab on the website (Potlatch) there are other tools, which allow you to edit the OSM data via the API. 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.