(mapJSONObj, mapOptions)
| 132 | * @returns {CRS} 返回CRS。 |
| 133 | */ |
| 134 | export function crsFromMapJSON(mapJSONObj, mapOptions) { |
| 135 | const { maxZoom = 22 } = mapOptions || {}; |
| 136 | |
| 137 | const { bounds, prjCoordSys, dpi, visibleScales, coordUnit, origin } = mapJSONObj; |
| 138 | let resolutions = mapJSONObj.resolutions; |
| 139 | if (!resolutions) { |
| 140 | resolutions = scalesToResolutions(visibleScales, bounds, dpi, coordUnit, maxZoom); |
| 141 | } |
| 142 | if (isPlaneProjection(prjCoordSys.type)) { |
| 143 | return getNonEarthCRS(bounds, origin, resolutions); |
| 144 | } |
| 145 | const epsgCodeStr = getEpsgCode(prjCoordSys); |
| 146 | if (!hasRegisterProj(epsgCodeStr)) { |
| 147 | return; |
| 148 | } |
| 149 | return getCRS(epsgCodeStr, { bounds, dpi, resolutions, origin }); |
| 150 | } |
| 151 | |
| 152 | /** |
| 153 | * @private |
no test coverage detected