转载: utm坐标和经纬度相互转换
原文地址: https://blog.csdn.net/hanshuobest/article/details/77752279 //经纬度转utm坐标
int convert_lonlat_utm(const new3s_PointXYZ &lon_lat_coord, new3s_PointXYZ &utm_coord)
{
OGRSpatialReference *RefSource = new OGRSpatialReference;
RefSource->SetWellKnownGeogCS("WGS84"); OGRSpatialReference *RefTarget = new OGRSpatialReference;
RefTarget = RefSource->CloneGeogCS();
int utmzone = lon_lat_coord.get_x() / 6 + 31;
RefTarget->SetProjCS("UTM(WGS84) in northern hemisphere.");
RefTarget->SetUTM(utmzone, TRUE);
OGRCoordinateTransformation *poTransform = OGRCreateCoordinateTransformation(RefSource, RefTarget); double tempX = lon_lat_coord.get_x();
double tempY = lon_lat_coord.get_y();
double tempZ = lon_lat_coord.get_z(); poTransform->Transform(1, &tempX, &tempY, &tempZ);
utm_coord.set_x(tempX);
utm_coord.set_y(tempY);
utm_coord.set_z(tempZ); return utmzone;
}
//utm转经纬度
void convert_utm_lonlat(const new3s_PointXYZ &utm_coord, const int &utmzone, new3s_PointXYZ &lon_lat_coord)
{
//建立投影坐标系到经纬度坐标系的转换
OGRSpatialReference *RefSource = new OGRSpatialReference;
RefSource->SetWellKnownGeogCS("WGS84");
RefSource->SetProjCS("UTM(WGS84) in northern hemisphere.");
RefSource->SetUTM(utmzone, TRUE);
OGRSpatialReference *RefTarget = new OGRSpatialReference;
RefTarget = RefSource->CloneGeogCS();
OGRCoordinateTransformation *poTranform = OGRCreateCoordinateTransformation(RefSource, RefTarget); OGRPoint *poPoint = new OGRPoint();
double tempx = utm_coord.get_x();
double tempy = utm_coord.get_y();
double tempz = utm_coord.get_z(); poTranform->Transform(1, &tempx, &tempy, NULL);
lon_lat_coord = new3s_PointXYZ(tempx, tempy, tempz);
转载: utm坐标和经纬度相互转换的更多相关文章
- ArcGIS Engine 下投影坐标和经纬度坐标的相互转换
ArcGIS Engine 下投影坐标和经纬度坐标的相互转换 投影转经纬度 ); pPoint.Project(pSRF.CreateGeographicCoordinateSystem((int)e ...
- ArcEngine下投影坐标和经纬度坐标的相互转换
jojojojo2002 原文 ArcEngine下投影坐标和经纬度坐标的相互转换 投影转经纬度 private IPoint PRJtoGCS( double x, double y) { IPoi ...
- WGS84坐标和UTM坐标的转换
如题.做了一个Demo,主要是把最后面的参考资料1里面的脚本改成了C语言版本的. 代码: #ifndef __COORCONV_H__ #define __COORCONV_H__ #include ...
- [转载]WGS84坐标与Web墨卡托坐标互转
//经纬度转Wev墨卡托 dvec3 CMathEngine::lonLat2WebMercator(dvec3 lonLat) { dvec3 mercator; ; +lonLat.y)*PI/) ...
- R实现地理位置与经纬度相互转换
本实例要实现目标通过输入城市名或者地名,然后找出其经度纬度值,以及通过可视化展现其线路流向以及周边地图展示 address_list数据: 山西省太原市小店区亲贤北街77号 贵州省贵阳市云岩区书香门第 ...
- C# UTM坐标和WGS84坐标转换小工具
工具根据:http://home.hiwaay.net/~taylorc/toolbox/geography/geoutm.html js代码改编 工具源码github:https://github. ...
- python坐标获取经纬度或经纬度获取坐标免费模块--geopy
一.官方文档 https://github.com/geopy/geopy 二.模块安装 pip3 install geopy 三.简单实用 from geopy.geocoders import N ...
- 百度、高德、谷歌、火星、wgs84(2000)地图坐标相互转换的JS实现
一.调用例子: <!DOCTYPE html> <html lang="en"> <head> <meta charset="U ...
- 使用ArcGIS实现WGS84经纬度坐标到北京54高斯投影坐标的转换
[摘 要] 本文针对从事测绘工作者普遍遇到的坐标转换问题,简要介绍ArcGIS实现WGS84经纬度坐标到北京54高斯投影坐标转换原理和步骤. [关键词] ArcGIS 坐标转换 投影变换 1 坐标转换 ...
随机推荐
- 在win10系统安装两个不同版本的mySQL数据库
我们项目用的mySQL数据库,为了回家看代码方便,于是在本地安装mySQL数据库,一开始安装了比服务器mySQL5.7.24更高版本的mySQL8.0.11,结果项目启动报错,估计是版本太高项目中引入 ...
- uboot下如何读写rtc pcf2127的寄存器?
一. pcf2127简介 pcf2127是实时时钟计数器模块,支持两种接口,i2c和spi,笔者以i2c为例 二. pcf2127的读写操作时序 2.1 写操作 根据i2c的规范https://www ...
- js常用遍历汇总
1, for(let i of Array) for( let i of arr){ console.log(i); } ES6新增的,i代表每次循环Array的值,相当于Array[0]到Array ...
- Appium移动自动化测试(二)之appuim + 夜神模拟器
环境搭建起来之后, 就可以开始移动自动化了. 但是使用自带的AVD开启模拟器, 速度实在太慢. 于是用夜神来做替代, 稍微能够有一些提速. 启动appuim 打开Appium,点击右上角Start按钮 ...
- 小D课堂 - 新版本微服务springcloud+Docker教程_3-02CAP理论知识
笔记 2.分布式应用知识CAP理论知识 简介:讲解分布式核心知识CAP理论 CAP定理: 指的是在一个分布式系统中,Consistency(一致性). Availabi ...
- ubuntu下wps的安装
(一)安装 1)下载:WPS For Linux http://community.wps.cn/download/ 下载wps-office_10.1.0.5672~a21_amd64.deb 2) ...
- golang(09) golang 接口内部实现
原文链接 http://www.limerence2017.com/2019/09/24/golang14/#more 前文介绍过golang interface用法,本文详细剖析interface内 ...
- charles获取抓包数据
charles获取抓包数据 第一步:确保手机和电脑处于同一个局域网之下 第二步:进入 charles 的代理设定选项(主导航栏Proxy-----Proxy Setting......)中,允许代理, ...
- springboot和springcloud版本冲突问题
最近搭建eureka项目,出现boot和cloud版本不匹配错误,记录下来 2019-12-06 14:00:20.043 ERROR 180780 --- [ main] o.s.boot.Spri ...
- Android开发 移动端适配
1 UI自适应(UGUI) UI自适应又分为锚点自适应和缩放.锚点主要控制UI控件在父控件之中的位置,同时也能影响缩放. 锚点自适应缩放: 我们使用UGUI创建一个界面,设计使用1920x1080分辨 ...