Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var raster = new ol.layer.Tile({
- source: new ol.source.OSM()
- });
- var map = new ol.Map({
- layers: [raster],
- target: 'map',
- view: new ol.View({
- resolutions : customRes,
- center: [-11000000, 4600000],
- resolution : 156543.0339
- })
- });
- /**
- * get the resolution out of scale
- * @param {number} scale as declared in the config eg 50000
- * @returns {window.webGisApp.main.resolutions}
- */
- function getResolutionFromScale(scale){
- var dpi = 25.4 / 0.28;
- var mpu = ol.proj.METERS_PER_UNIT['m'];
- var res = scale / (mpu * 39.37 * dpi);
- return res;
- }
- /**
- * get the resolution out of scale
- * @param {number} res the resolution
- * @returns {webGisApp.main.resolutions}
- */
- function getScaleFromResolution(res){
- var dpi = 25.4 / 0.28;
- var mpu = ol.proj.METERS_PER_UNIT['m'];
- var scale = res * mpu * 39.37 * dpi;
- return scale;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement