MCPcopy Index your code
hub / github.com/SuperMap/iClient-JavaScript / getResolutionFromScaleDpi

Function getResolutionFromScaleDpi

src/leaflet/core/Util.js:197–219  ·  view source on GitHub ↗
(scale, dpi, coordUnit, datumAxis)

Source from the content-addressed store, hash-verified

195 * ```
196 */
197export var getResolutionFromScaleDpi = function(scale, dpi, coordUnit, datumAxis) {
198 var resolution = null,
199 ratio = 10000;
200 //用户自定义地图的Options时,若未指定该参数的值,则系统默认为6378137米,即WGS84参考系的椭球体长半轴。
201 datumAxis = datumAxis || 6378137;
202 coordUnit = coordUnit || '';
203 if (scale > 0 && dpi > 0) {
204 scale = normalizeScale(scale);
205 if (
206 coordUnit.toLowerCase() === 'degree' ||
207 coordUnit.toLowerCase() === 'degrees' ||
208 coordUnit.toLowerCase() === 'dd'
209 ) {
210 //scale = CommonUtil.normalizeScale(scale);
211 resolution = (0.0254 * ratio) / dpi / scale / ((Math.PI * 2 * datumAxis) / 360) / ratio;
212 return resolution;
213 } else {
214 resolution = (0.0254 * ratio) / dpi / scale / ratio;
215 return resolution;
216 }
217 }
218 return -1;
219};
220export {
221 getZoomByResolution,
222 scalesToResolutions,

Callers 1

WebMap.jsFile · 0.90

Calls 1

normalizeScaleFunction · 0.85

Tested by

no test coverage detected