diff --git a/examples/wms-custom-proj.js b/examples/wms-custom-proj.js index 39ba860d2b..8463e8c49a 100644 --- a/examples/wms-custom-proj.js +++ b/examples/wms-custom-proj.js @@ -8,10 +8,15 @@ goog.require('ol.proj'); goog.require('ol.source.TileWMS'); -var projection = ol.proj.configureProj4jsProjection({ +var proj4Proj = new proj4.Proj('EPSG:21781'); +var projection = ol.proj.addProjection({ code: 'EPSG:21781', - extent: [485869.5728, 76443.1884, 837076.5648, 299941.7864] + extent: [485869.5728, 76443.1884, 837076.5648, 299941.7864], + units: proj4Proj.units }); +// The transform is needed for the ScaleLine control. Otherwise this example +// would also work without proj4js. +ol.proj.addCoordinateTransforms('EPSG:4326', projection, proj4(proj4Proj)); var extent = [420000, 30000, 900000, 350000]; var layers = [