You can switch a website to OpenStreetMap in under an hour. Choose a JavaScript API and a tile provider, and you’re ready to go. Then, as your needs increase, you can consider custom tiles, either from a specialist provider or generated yourself.

Choosing an API/library

Unlike commercial online map providers, OpenStreetMap does not provide an “official” JavaScript library which you are required to use. Rather, you can use any library that meets your needs. The two most popular are OpenLayers and Leaflet. Both are open source.


Getting started with OpenLayers – a mature, feature-rich library

Getting started with Leaflet – a new, lighter library
If you choose to use MapQuest Open tiles (made from OSM data), you can also use the MapQuest Open API which adds routing and geocoding capabilities to the standard featureset.
Mapstraction is a library which enables you to switch from one mapping provider to another without changing your code.

Choosing a tile provider

Apart from very limited testing purposes, you should not use the tiles supplied by OpenStreetMap.org itself. OpenStreetMap is a volunteer-run non-profit body and cannot supply tiles for large-scale commercial use. Rather, you should use a third party provider that makes tiles from OSM data, or generate your own.

Free providers:

Paid-for providers: see list.

Or go on to find out how to generate and serve your own tiles.