diff --git a/examples/wms-custom-proj.js b/examples/wms-custom-proj.js index 1956f3426e..e3b5f2920b 100644 --- a/examples/wms-custom-proj.js +++ b/examples/wms-custom-proj.js @@ -10,6 +10,10 @@ goog.require('ol.source.TileWMS'); +// By default OpenLayers does not know about the EPSG:21781 (Swiss) projection. +// So we create a projection instance for EPSG:21781 and pass it to +// ol.proj.addProjection to make it available to the library. + var projection = new ol.proj.Projection({ code: 'EPSG:21781', // The extent is used to determine zoom level 0. Recommended values for a @@ -18,6 +22,11 @@ var projection = new ol.proj.Projection({ units: 'm' }); ol.proj.addProjection(projection); + +// We also declare EPSG:21781/EPSG:4326 transform functions. These functions +// are necessary for the ScaleLine control and when calling ol.proj.transform +// for setting the view's initial center (see below). + ol.proj.addCoordinateTransforms('EPSG:4326', projection, function(coordinate) { return [