python GCJ-02转CGCS2000 界面脚本

 安装扩展 执行命令  pip install pyproj

import tkinter as tk
from pyproj import Transformer

# 创建 GUI 界面
root = tk.Tk()
root.title("GCJ-02 转 CGCS2000 坐标转换器")

# 创建输入框和标签
gcj_lat_label = tk.Label(root, text="GCJ-02 纬度:")
gcj_lat_label.grid(row=0, column=0)
gcj_lat_entry = tk.Entry(root)
gcj_lat_entry.grid(row=0, column=1)

gcj_lon_label = tk.Label(root, text="GCJ-02 经度:")
gcj_lon_label.grid(row=1, column=0)
gcj_lon_entry = tk.Entry(root)
gcj_lon_entry.grid(row=1, column=1)

# 创建输出框和标签
cgcs_lat_label = tk.Label(root, text="CGCS2000 纬度:")
cgcs_lat_label.grid(row=2, column=0)
cgcs_lat_entry = tk.Entry(root)
cgcs_lat_entry.grid(row=2, column=1)

cgcs_lon_label = tk.Label(root, text="CGCS2000 经度:")
cgcs_lon_label.grid(row=3, column=0)
cgcs_lon_entry = tk.Entry(root)
cgcs_lon_entry.grid(row=3, column=1)

# 创建转换函数
def convert():
    gcj_lat = float(gcj_lat_entry.get())
    gcj_lon = float(gcj_lon_entry.get())
    transformer = Transformer.from_crs("EPSG:4326", "EPSG:4490")
    cgcs_lon, cgcs_lat = transformer.transform(gcj_lon, gcj_lat)
    cgcs_lat_entry.delete(0, tk.END)
    cgcs_lat_entry.insert(0, str(cgcs_lat))
    cgcs_lon_entry.delete(0, tk.END)
    cgcs_lon_entry.insert(0, str(cgcs_lon))

# 创建转换按钮
convert_button = tk.Button(root, text="转换", command=convert)
convert_button.grid(row=4, column=0, columnspan=2)

# 运行 GUI 界面
root.mainloop()

编译好的 直接下转换软件

  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 3
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值