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

Function getProjection

src/common/mapping/utils/epsg-define.js:27–42  ·  view source on GitHub ↗
(epsgKey, proj4 = proj4FromNpm)

Source from the content-addressed store, hash-verified

25}
26
27export function getProjection(epsgKey, proj4 = proj4FromNpm) {
28 if (!proj4.defs(epsgKey)) {
29 const epsgCodes = {
30 'EPSG:3857':
31 'PROJCS["WGS 84 / Pseudo-Mercator",GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4326"]],PROJECTION["Mercator_Auxiliary_Sphere"],PARAMETER["central_meridian",0],PARAMETER["scale_factor",1],PARAMETER["false_easting",0],PARAMETER["false_northing",0],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AXIS["X",EAST],AXIS["Y",NORTH],EXTENSION["PROJ4","+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs"],AUTHORITY["EPSG","3857"]]',
32 'EPSG:4326':
33 'GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],AXIS["Easting", "EAST"],AXIS["Northing", "NORTH"],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4326"]]',
34 'EPSG:4490':
35 'GEOGCS["China Geodetic Coordinate System 2000", DATUM["China 2000", SPHEROID["CGCS2000", 6378137.0, 298.257222101, AUTHORITY["EPSG","1024"]], AUTHORITY["EPSG","1043"]], PRIMEM["Greenwich", 0.0, AUTHORITY["EPSG","8901"]], UNIT["degree", 0.017453292519943295], AXIS["Geodetic latitude", NORTH], AXIS["Geodetic longitude", EAST], AUTHORITY["EPSG","4490"]]'
36 };
37 if (epsgCodes[epsgKey]) {
38 registerProjection(epsgKey, epsgCodes[epsgKey], proj4);
39 }
40 }
41 return proj4.defs(epsgKey);
42}
43
44export function toEpsgCode(wkt) {
45 if (typeof wkt !== 'string') {

Callers 4

epsgDefineSpec.jsFile · 0.90
getLayerFeaturesMethod · 0.90
_getProjectionWKTMethod · 0.90

Calls 1

registerProjectionFunction · 0.85

Tested by

no test coverage detected