forked from openlayers/openlayers
-
Notifications
You must be signed in to change notification settings - Fork 0
API & Defaults Discussion
ahocevar edited this page Feb 20, 2013
·
3 revisions
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.
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
}
});
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.