1.EPSG代码
搜索地理坐标系对应的EPSG代码
https://epsg.io/
常用的地理坐标系EPSG代码:
2. 坐标系转换
转换网址: https://epsg.io/transform
(1)修改 input coordinate system 和 output coordinate system,
可以通过搜索地理坐标系对应的EPSG代码进行修改
3. 多点转换的python代码
from pprint import pprint
import openpyxl
import numpy as np
import requests # 导入requests包
import json
import time
import pandas as pd
import os
def get_date(url=None,file_out_path=None,Referer=None):
f_out_name=file_out_path+'validation_nita_corrected.txt'
# print(f_out_name)
with open(f_out_name, "a") as f:
headers = {
'Sec-Ch-Ua': '"Microsoft Edge";v="119", "Chromium";v="119", "Not?A_Brand";v="24"',
'Sec-Ch-Ua-Mobile':'?0',
'Sec-Ch-Ua-Platform': '"Windows"',
'Referer': Referer,
'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36 Edg/119.0.0.0'
}
# 请求表单数据
response = requests.get(url, headers=headers, verify=False)
# print(response)
content = response.text
# print(content)
# print(type(content))
# 给定的字符串
data_string = content
# 解析字符串
parsed_data = json.loads(data_string)
# 提取数字
x_value = parsed_data['results'][0]['x']
y_value = parsed_data['results'][0]['y']
z_value = parsed_data['results'][0]['z']
# 输出提取的数字
print("x:", x_value)
print("y:", y_value)
print("z:", z_value)
# print(f_out_name)
# with open(f_out_name, "w") as f:
str1=str(x_value)+','+str(y_value)+','+str(z_value)+'\n'
f.write(str(str1))
if __name__ == '__main__':
# 打开 Excel 文件
workbook = openpyxl.load_workbook('C://Users/DELL/Desktop/validation_nita_corrected.xlsx')
# 选择第一个工作表
sheet = workbook.active
# 从第二行开始读取数字
matrix_data = []
for row in sheet.iter_rows(min_row=2, values_only=True):
row_data = []
for cell in row:
if isinstance(cell, (int, float)):
row_data.append(cell)
if len(row_data) == 6: # 确保每行有六个数据
matrix_data.append(row_data)
print('yes')
# 将二维列表转换为 NumPy 数组
print(matrix_data)
matrix = np.array(matrix_data)
num_rows=matrix.shape[0]
num_cols=matrix.shape[1]
print(num_rows)
file_out_path='C://Users/DELL/Desktop/'
for i in range(0,num_rows-1):
#for i in range(0,3):
print(i)
try:
url = 'https://epsg.io/srs/transform/'+str(matrix[i,6])+','+str(matrix[i,7])+'.json?key=default&s_srs=3844&t_srs=4326'
print(url)
referer='https://epsg.io/transform/'
get_date(url=url,file_out_path=file_out_path,Referer=referer)
except OSError:
pass
continue