Updated API & Defaults Discussion (markdown)

ahocevar
2013-02-20 12:47:50 -08:00
parent 03428a706f
commit bdffb250eb
+45 -1
@@ -1 +1,45 @@
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.
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.
## Map with WMS layer (tiled) in default projection (EPSG:3857)
new ol.Map({
layers: [
// suitable layer type can be chosen based on the source
new ol.source.TiledWMS({
url: '/geoserver/wms',
params: {
'LAYERS': 'usa:states' // would be nice without quotes for the key
}
})
],
// would be even nicer to provide center and zoom as direct map config options
view: {
center: [47, 15],
zoom: 9
}
});
## Map with custom projection and a WMS layer
new ol.Map({
layers: [
// suitable layer type can be chosen based on the source
new ol.source.TiledWMS({
url: '/geoserver/wms',
params: {
'LAYERS': 'usa:states' // would be nice without quotes for the key
}
})
],
// would be even nicer to provide center and zoom as direct map config options
view: {
projection: {
code: 'EPSG:31256',
extent: [-115317.3972, 151511.8020, 64307.1064, 432456.2246]
},
center: [47, 15],
zoom: 3
}
});
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.