API & Defaults Discussion · openlayers/ol3 Wiki · GitHub
OpenLayers 3 should provide an API that makes it easy to accomplish common use cases. People who do not need to leverage the full functionality should be provided fast lanes for a leaner and easy to use configuration. Defaults should be set in the right places to avoid duplicated code. This document is work in progress. At the time of writing, it reflects @ahocevar’s thoughts on a few aspects of the library that come to mind when thinking about API and defaults. The layer source should not need a projection configuration – it should get it from the view. With the projection’s extent, the layer source should be able to create a default tile grid. The map’s zoom levels will be derived from the projection’s extent as well. Exactly the same as above, only with ol.source.SingleImageWMS instead of ol.Source.TiledWMS. It should not be necessary to configure the layer source with a resolutions array, and a single image source should be able to serve any resolution that the map uses. Since the TileGrid is a very complex thing, and most use cases except ArcGISCache and WMTS use the same grid extent for each resolution, it makes sense to provide a convenience configuration with a common maxExtent and a set of resolutions. Looking at the current code, there are still more than one places with Web Mercator related defaults. The central place for projection related defaults should be the ol.projection package. If layer sources can lazily create a TileGrid upon rendering, it will be possible to use map defaults for layer sources. The concept of user projections works best in the context of a map. Classes like Coordinate or Extent do not necessarily need to know about the user projection if the map (or the view) provides extent and center related getters. Source.