Update example to show transparent proj4js integration

This commit is contained in:
Andreas Hocevar
2014-07-08 01:10:47 +02:00
parent dfe92da58d
commit 0c62469f50
2 changed files with 11 additions and 5 deletions

View File

@@ -37,7 +37,7 @@
<p>Pixelmap 1:1'000'000 with National Parks overlay using the projection EPSG:21781.</p> <p>Pixelmap 1:1'000'000 with National Parks overlay using the projection EPSG:21781.</p>
<p>See the <a href="wms-image-custom-proj.js" target="_blank">wms-image-custom-proj.js source</a> to see how this is done.</p> <p>See the <a href="wms-image-custom-proj.js" target="_blank">wms-image-custom-proj.js source</a> to see how this is done.</p>
</div> </div>
<div id="tags">wms, single image, projection</div> <div id="tags">wms, single image, proj4js, projection</div>
</div> </div>
</div> </div>

View File

@@ -1,15 +1,16 @@
goog.require('ol.Attribution'); goog.require('ol.Attribution');
goog.require('ol.Map'); goog.require('ol.Map');
goog.require('ol.View'); goog.require('ol.View');
goog.require('ol.control');
goog.require('ol.control.ScaleLine');
goog.require('ol.layer.Image'); goog.require('ol.layer.Image');
goog.require('ol.proj'); goog.require('ol.proj');
goog.require('ol.source.ImageWMS'); goog.require('ol.source.ImageWMS');
var projection = ol.proj.configureProj4jsProjection({ var projection = ol.proj.get('EPSG:21781');
code: 'EPSG:21781', // The extent is used to determine zoom level 0
extent: [485869.5728, 76443.1884, 837076.5648, 299941.7864] projection.setExtent([485869.5728, 76443.1884, 837076.5648, 299941.7864]);
});
var extent = [420000, 30000, 900000, 350000]; var extent = [420000, 30000, 900000, 350000];
var layers = [ var layers = [
@@ -49,6 +50,11 @@ var layers = [
]; ];
var map = new ol.Map({ var map = new ol.Map({
controls: ol.control.defaults().extend([
new ol.control.ScaleLine({
units: 'metric'
})
]),
layers: layers, layers: layers,
renderer: exampleNS.getRendererFromQueryString(), renderer: exampleNS.getRendererFromQueryString(),
target: 'map', target: 'map',