diff --git a/API-&-Defaults-Discussion.md b/API-&-Defaults-Discussion.md index cf3e203..330b064 100644 --- a/API-&-Defaults-Discussion.md +++ b/API-&-Defaults-Discussion.md @@ -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. \ No newline at end of file +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. \ No newline at end of file