當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript proj4.defs函數代碼示例

本文整理匯總了TypeScript中proj4.defs函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript defs函數的具體用法?TypeScript defs怎麽用?TypeScript defs使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了defs函數的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1:

  }
);

const crs3 = new L.Proj.CRS('EPSG:3006',
  '+proj=utm +zone=33 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs',
  {
    origin: [218128.7031, 6126002.9379],
    resolutions: [8192, 4096, 2048],
    scales: [1, 2],
    bounds: new L.Bounds([[1, 2], [3, 4]]),
    transformation: new L.Transformation(1, 2, 3, 4),
  }
);

// geoJson
proj4.defs("urn:ogc:def:crs:EPSG::26915", "+proj=utm +zone=15 +ellps=GRS80 +datum=NAD83 +units=m +no_defs");

const geojson = {
  type: "Feature",
  geometry: {
    type: "Point",
    coordinates: [481650, 4980105]
  },
  crs: {
    type: "name",
    properties: {
      name: "urn:ogc:def:crs:EPSG::26915"
    }
  }
};
開發者ID:IceCreamYou,項目名稱:DefinitelyTyped,代碼行數:30,代碼來源:proj4leaflet-tests.ts

示例2: proj4

const point1 = [-71, 41]
const point2 = {x: 2, y: 5}
const mgrs = "24XWT783908"

///////////////////////////////////////////
// Tests Measurement
///////////////////////////////////////////
proj4(epsg['4269'], epsg['4326'], point1)
proj4(epsg['4269'], point1)
proj4(epsg['4269'], epsg['4326']).forward(point2)
proj4(epsg['4269'], epsg['4326']).inverse(point2)

///////////////////////////////////
// Named Projections
///////////////////////////////////
proj4.defs('WGS84', epsg['4326'])
proj4.defs([
  ['EPSG:4326', epsg['4326']],
  ['EPSG:4269', epsg['4269']]
])
proj4.defs('urn:x-ogc:def:crs:EPSG:4326', proj4.defs('EPSG:4326'))

///////////////////////////////////
// Utils
///////////////////////////////////
// WGS84
proj4.WGS84

// Proj
proj4.Proj('WGS84')
開發者ID:Agamnentzar,項目名稱:DefinitelyTyped,代碼行數:30,代碼來源:proj4-tests.ts

示例3:

  IConnection,
  IDiva,
  IMode,
  INode,
  IPin,
  IPlatform,
  IStop,
  IStopLocation,
  ITrip,
  PIN_TYPE,
  POI_TYPE,
} from "./interfaces";

// EPSG:31468
proj4.defs(
  "GK4",
  "+proj=tmerc +lat_0=0 +lon_0=12 +k=1 +x_0=4500000 +y_0=0 +ellps=bessel +datum=potsdam +units=m +no_defs"
);

// EPSG:3857
proj4.defs(
  "WM",
  "+proj=merc +lon_0=0 +k=1 +x_0=0 +y_0=0 +a=6378137 +b=6378137 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs"
);

export function WGS84toGK4(lng: number, lat: number): coord {
  return proj4("WGS84", "GK4", [lng, lat]).map(Math.round);
}

export function WGS84toWm(lng: number, lat: number): coord {
  return proj4("WGS84", "WM", [lng, lat]).map(Math.round);
}
開發者ID:kiliankoe,項目名稱:dvbjs,代碼行數:32,代碼來源:utils.ts


注:本文中的proj4.defs函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。