Customizing a view
Customizing the view is not a hard task; it manly consists of considerations regarding the nature of the project and expected outcome. For our application, wrapping the map around the x axis is completely needless. Also, we can restrict the extent to the projection's extent. In the first example, called ch06_customize
, we make such modifications in our application. First, we disable the layer wrapping in our base layers:
var map = new ol.Map({ […] new ol.layer.Tile({ source: new ol.source.TileWMS({ […] wrapX: false […] new ol.layer.Vector({ source: new ol.source.Vector({ […] wrapX: false }),
Tip
Unlike in OpenLayers 2, you cannot make a high level decision to disable layer wrapping for the entire map. You have to disable it layer-wise in the layer's source
object, as it is enabled in most of the...