(wkt)
| 42 | } |
| 43 | |
| 44 | export function toEpsgCode(wkt) { |
| 45 | if (typeof wkt !== 'string') { |
| 46 | return ''; |
| 47 | } else if (wkt.indexOf('EPSG') === 0) { |
| 48 | return wkt; |
| 49 | } else { |
| 50 | let lastAuthority = wkt.lastIndexOf('AUTHORITY') + 10; |
| 51 | let endString = wkt.indexOf(']', lastAuthority) - 1; |
| 52 | if (lastAuthority > 0 && endString > 0) { |
| 53 | return `EPSG:${wkt |
| 54 | .substring(lastAuthority, endString) |
| 55 | .split(',')[1] |
| 56 | .substr(1)}`; |
| 57 | } else { |
| 58 | return ''; |
| 59 | } |
| 60 | } |
| 61 | } |
| 62 | |
| 63 | export function transformCoodinates({ coordinates, sourceProjection, destProjection = 'EPSG:4326', proj4 = proj4FromNpm }) { |
| 64 | try { |
no test coverage detected