MCPcopy Create free account
hub / github.com/SuperMap/iClient-JavaScript / toEpsgCode

Function toEpsgCode

src/common/mapping/utils/epsg-define.js:44–61  ·  view source on GitHub ↗
(wkt)

Source from the content-addressed store, hash-verified

42}
43
44export 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
63export function transformCoodinates({ coordinates, sourceProjection, destProjection = 'EPSG:4326', proj4 = proj4FromNpm }) {
64 try {

Callers 4

epsgDefineSpec.jsFile · 0.90
_registerMapCRSMethod · 0.90
_initOverlayLayerMethod · 0.90
_getProjectionWKTMethod · 0.90

Calls 1

indexOfMethod · 0.80

Tested by

no test coverage detected