gpt4 book ai didi

ios - 如何将 ios esri arcGIS 点转换为纬度和经度

转载 作者:塔克拉玛干 更新时间:2023-11-02 10:02:41 24 4
gpt4 key购买 nike

我有一个服务返回 arcgis json 格式,我想将这个几何点转换为经度和纬度 ios示例:

"geometryType": "esriGeometryPoint",
"geometry": {
"x": 445340.99496,
"y": 2423705.6300004,
"spatialReference": {
"wkid": 32637,
"latestWkid": 32637
}
}

我转换点数

AGSGraphic *testGraphic = [[AGSGraphic alloc] initWithJSON:jsonData] ;

我如何从AGSGraphic中获取经度和纬度

最佳答案

这解决了问题,只需发送 xPoint 和 yPoint,它将返回包含 lng 和 latit 的 CLLocation 对象

 -(CLLocation *) convertToLongAndLat:(double) xPoint andYPoint :(double) yPoint {

double originShift = 2 * M_PI * 6378137 / 2.0;

double lon = (xPoint / originShift) * 180.0;
double lat = (yPoint / originShift) * 180.0;

lat = 180 / M_PI * (2 * atan( exp( lat * M_PI / 180.0)) - M_PI / 2.0);

return [[CLLocation alloc] initWithLatitude:lat longitude:lon];
}

关于ios - 如何将 ios esri arcGIS 点转换为纬度和经度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27600269/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com