* @private * @function transformMapCenter * @description 转换center。 * @param {Object} mapInfoCenter - 中心点。 * @param {string} baseProjection - 坐标投影。 * @returns {Array}
(mapInfoCenter, sourceProjection)
| 107 | * @returns {Array} |
| 108 | */ |
| 109 | function transformMapCenter(mapInfoCenter, sourceProjection) { |
| 110 | let center = mapInfoCenter; |
| 111 | if (sourceProjection === 'EPSG:3857') { |
| 112 | return proj4(sourceProjection, 'EPSG:4326', mapInfoCenter); |
| 113 | } |
| 114 | if (sourceProjection !== 'EPSG:4326') { |
| 115 | return maplibregl.proj4(sourceProjection, 'EPSG:4326', mapInfoCenter); |
| 116 | } |
| 117 | return center; |
| 118 | } |
| 119 | |
| 120 | /** |
| 121 | * @private |