From 0c62469f507b54536ee51d5fc8697b398f6dafbf Mon Sep 17 00:00:00 2001 From: Andreas Hocevar Date: Tue, 8 Jul 2014 01:10:47 +0200 Subject: [PATCH] Update example to show transparent proj4js integration --- examples/wms-image-custom-proj.html | 2 +- examples/wms-image-custom-proj.js | 14 ++++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/examples/wms-image-custom-proj.html b/examples/wms-image-custom-proj.html index 474aa9540a..8c0868f4e9 100644 --- a/examples/wms-image-custom-proj.html +++ b/examples/wms-image-custom-proj.html @@ -37,7 +37,7 @@

Pixelmap 1:1'000'000 with National Parks overlay using the projection EPSG:21781.

See the wms-image-custom-proj.js source to see how this is done.

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