Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

arcgis 坐标系转换 #13

Open
zhongs opened this issue May 8, 2020 · 0 comments
Open

arcgis 坐标系转换 #13

zhongs opened this issue May 8, 2020 · 0 comments

Comments

@zhongs
Copy link
Owner

zhongs commented May 8, 2020

4326 地理坐标系
102100 投影坐标系

文档地址
https://developers.arcgis.com/javascript/3/jsapi/esri.geometry.webmercatorutils-amd.html

/**
 * 坐标转换 { wkid:4326 } 转换 { wkid:102100 }
 * @param {SpatialReference} source 要转换的SpatialReference对象
 * @param {<SpatialReference} target
 */
export const transformCoordinate = (source, target) => {
  return loadModules([
    "esri/geometry/webMercatorUtils",
    "esri/SpatialReference"
  ]).then(function ({ webMercatorUtils, SpatialReference }) {
    const sr = new SpatialReference(target)
    if (webMercatorUtils.canProject(source, sr)) {
      return webMercatorUtils.project(source, sr)
    }
  })
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant