By default, the WMS layer makes requests for 256 x 256 (pixel) images to fill your map viewport and beyond. As you pan and zoom around your map, more requests for images go out to fill the areas you haven’t yet visited. While your browser will cache some requested images, a lot of processing work is typically required for the server to dynamically render images. Since tiled layers (such as the WMS layer) make requests for images on a regular grid, it is possible for the server to cache these image requests and return the cached result next time you (or someone else) visits the same area – resulting in better performance all around. The Web Map Service specification allows a lot of flexibility in terms of what a client can request. Without constraints, this makes caching difficult or impossible in practice. At the opposite extreme, a service might offer tiles only at a fixed set of zoom levels and only for a regular grid. These can be generalized as XYZ layers – you can consider X and Y to indicate the column and row of the grid and Z to represent the zoom level. The OpenStreetMap (OSM) project is an effort to collect and make freely available map data for the world. OSM provides a few different renderings of their data as cached tile sets. These renderings conform to the basic XYZ grid arrangement and can be used in an OpenLayers map. The OpenLayers.Layer.OSM constructor accesses OpenStreetMap tiles. Geospatial data can come in any number of coordinate reference systems. One data set might use geographic coordinates (longitude and latitude) in degrees, and another might have coordinates in a local projection with units in meters. A full discussion of coordinate reference systems is beyond the scope of this module, but it is important to understand the basic concept. OpenLayers needs to know the coordinate system for your data. Internally, this is represented with an OpenLayers.Projection object. The transform function also takes strings that represent the coordinate reference system (‘EPSG:4326’ and ‘EPSG:3857’ above). The OpenStreetMap tiles that we will be using are in a Mercator projection. Because of this, we need to set the initial center using Mercator coordinates. Since it is relatively easy to find out the coordinates for a place of interest in geographic coordinates, we use the transform method to turn geographic coordinates (‘EPSG:4326’) into Mercator coordinates (‘EPSG:3857’). In the previous example we used the default options for our map. In this example, we set a custom map projection. As before, we create a layer and add it to our map. This time, we accept all the default options for the layer. A treatment of map controls is also outside the scope of this module, but these style declarations give you a sneak preview. By default, an OpenLayers.Control.Attribution control is added to all maps. This lets layers display attribution information in the map viewport. The declarations above alter the style of this attribution for our map (notice the small Copyright line at the bottom left of the map). Having mastered layers with publicly available cached tile sets, let’s move on to working with proprietary layers. Here you have some different renderings of OSM, extract the template URL and try to create your own custom OSM map: Source.