There are currently 3 main ways to use OpenStreetMap data:
- Google Maps API – However this would introduce licensing issues which were likely the reason OpenStreetMap data was chosen in the first place.
- OpenLayers – An open source Google Maps type API.
- OpenLayers via Mapstraction – The advantage of Mapstraction is that you write code once, and can then easily switch it between one of 9 major mapping providers including Microsoft, Yahoo, Google, MultiMap.
Using OpenLayers with OpenStreetMap
The process for using OpenLayers is relatively straight forward however involves a number of steps.
- Download OpenLayers
- Copy the OpenLayers “build/OpenLayers.js”, and “theme/”, “img/” directories to your webserver, putting them in the same directory (also be sure not to rename OpenLayers.js / change the letter case on the filename or it will not run correctly).
- Copy the OpenStreetMap HTML example script found on the Wiki to your webserver.
Or download a zip file with the above already completed, you just need to the edit the tile location path in “OpenStreetMap.js”.
Also see Part 1: Obtaining mapping Data.