Merge branch 'master' of github.com:openlayers/ol3 into vector
This commit is contained in:
@@ -21,10 +21,12 @@
|
||||
<tr>
|
||||
<th>DOM</th>
|
||||
<th>WebGL</th>
|
||||
<th>Canvas</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><div id="domMap" class="map"></div></td>
|
||||
<td><div id="webglMap" class="map"></div></td>
|
||||
<td><div id="canvasMap" class="map"></div></td>
|
||||
</tr>
|
||||
</table>
|
||||
<div id="docs">
|
||||
|
||||
@@ -41,3 +41,10 @@ var domMap = new ol.Map({
|
||||
});
|
||||
domMap.bindTo('layers', webglMap);
|
||||
domMap.bindTo('view', webglMap);
|
||||
|
||||
var canvasMap = new ol.Map({
|
||||
renderer: ol.RendererHint.DOM,
|
||||
target: 'canvasMap'
|
||||
});
|
||||
canvasMap.bindTo('layers', webglMap);
|
||||
canvasMap.bindTo('view', webglMap);
|
||||
|
||||
@@ -11,22 +11,12 @@ goog.require('ol.source.TiledWMS');
|
||||
|
||||
var epsg4326 = ol.projection.getFromCode('EPSG:4326');
|
||||
|
||||
// We give the single image source a set of resolutions. This prevents the
|
||||
// source from requesting images of arbitrary resolutions.
|
||||
var projectionExtent = epsg4326.getExtent();
|
||||
var maxResolution = Math.max(
|
||||
projectionExtent.maxX - projectionExtent.minX,
|
||||
projectionExtent.maxY - projectionExtent.minY) / 256;
|
||||
var resolutions = new Array(10);
|
||||
for (var i = 0; i < 10; ++i) {
|
||||
resolutions[i] = maxResolution / Math.pow(2.0, i);
|
||||
}
|
||||
|
||||
var layers = new ol.Collection([
|
||||
new ol.layer.TileLayer({
|
||||
source: new ol.source.TiledWMS({
|
||||
url: 'http://vmap0.tiles.osgeo.org/wms/vmap0',
|
||||
crossOrigin: null,
|
||||
version: '1.1.1',
|
||||
params: {
|
||||
'LAYERS': 'basic',
|
||||
'FORMAT': 'image/jpeg'
|
||||
|
||||
@@ -19,8 +19,10 @@ var epsg21781 = new ol.Projection('EPSG:21781', ol.ProjectionUnits.METERS,
|
||||
new ol.Extent(485869.5728, 76443.1884, 837076.5648, 299941.7864));
|
||||
ol.projection.addProjection(epsg21781);
|
||||
|
||||
// We give the single image source a set of resolutions. This prevents the
|
||||
// source from requesting images of arbitrary resolutions.
|
||||
// We could give the single image source a set of resolutions. This prevents the
|
||||
// source from requesting images of arbitrary resolutions. To try it, uncomment
|
||||
// the block below and the resolutions option in the SingleImageWMS config.
|
||||
/*
|
||||
var projectionExtent = epsg21781.getExtent();
|
||||
var maxResolution = Math.max(projectionExtent.getWidth(),
|
||||
projectionExtent.getHeight()) / 256;
|
||||
@@ -28,6 +30,7 @@ var resolutions = new Array(10);
|
||||
for (var i = 0; i < 10; ++i) {
|
||||
resolutions[i] = maxResolution / Math.pow(2.0, i);
|
||||
}
|
||||
*/
|
||||
|
||||
var extent = new ol.Extent(420000, 30000, 900000, 350000);
|
||||
var layers = new ol.Collection([
|
||||
@@ -42,20 +45,18 @@ var layers = new ol.Collection([
|
||||
'LAYERS': 'ch.swisstopo.pixelkarte-farbe-pk1000.noscale',
|
||||
'FORMAT': 'image/jpeg'
|
||||
},
|
||||
projection: epsg21781,
|
||||
extent: extent
|
||||
})
|
||||
}),
|
||||
new ol.layer.ImageLayer({
|
||||
source: new ol.source.SingleImageWMS({
|
||||
//resolutions: resolutions,
|
||||
url: 'http://wms.geo.admin.ch/',
|
||||
attributions: [new ol.Attribution(
|
||||
'© ' +
|
||||
'<a href="http://www.geo.admin.ch/internet/geoportal/en/home.html">' +
|
||||
'National parks / geo.admin.ch</a>')],
|
||||
params: {'LAYERS': 'ch.bafu.schutzgebiete-paerke_nationaler_bedeutung'},
|
||||
projection: epsg21781,
|
||||
resolutions: resolutions
|
||||
params: {'LAYERS': 'ch.bafu.schutzgebiete-paerke_nationaler_bedeutung'}
|
||||
})
|
||||
})
|
||||
]);
|
||||
|
||||
Reference in New Issue
Block a user