* 通过 WKT 参数获取坐标信息。 * * @param {string} wkt 字符串。 * @returns {string} EPSG,如:"EPSG:4326"。
(wkt)
| 4558 | * @returns {string} EPSG,如:"EPSG:4326"。 |
| 4559 | */ |
| 4560 | getEpsgInfoFromWKT(wkt) { |
| 4561 | if (typeof wkt !== 'string') { |
| 4562 | return false; |
| 4563 | } else if (wkt.indexOf('EPSG') === 0) { |
| 4564 | return wkt; |
| 4565 | } else { |
| 4566 | let lastAuthority = wkt.lastIndexOf('AUTHORITY') + 10, |
| 4567 | endString = wkt.indexOf(']', lastAuthority) - 1; |
| 4568 | if (lastAuthority > 0 && endString > 0) { |
| 4569 | return `EPSG:${wkt.substring(lastAuthority, endString).split(',')[1].substr(1)}`; |
| 4570 | } else { |
| 4571 | return false; |
| 4572 | } |
| 4573 | } |
| 4574 | } |
| 4575 | |
| 4576 | /** |
| 4577 | * @private |
no test coverage detected