| 245 | } |
| 246 | |
| 247 | function getCRS(epsgCodeStr, { bounds, origin, dpi, resolutions }) { |
| 248 | const wrapLngLeft = proj4(epsgCodeStr, 'EPSG:4326').forward([bounds.left, 0], true); |
| 249 | const wrapLngRight = proj4(epsgCodeStr, 'EPSG:4326').forward([bounds.right, 0], true); |
| 250 | const wrapLng = [parseInt(wrapLngLeft[0]), parseInt(wrapLngRight[0])]; |
| 251 | let options = { |
| 252 | wrapLng, |
| 253 | bounds: L.bounds([bounds.left, bounds.bottom], [bounds.right, bounds.top]), |
| 254 | origin: origin || [bounds.left, bounds.top], |
| 255 | dpi: dpi |
| 256 | }; |
| 257 | if (resolutions && resolutions.length > 0) { |
| 258 | options.resolutions = resolutions; |
| 259 | } |
| 260 | return new CRS(epsgCodeStr, options); |
| 261 | } |