完成了自动生成排位数据文件的功能

This commit is contained in:
n3040
2022-01-18 14:14:00 +08:00
parent bece894a0c
commit 7ad5ad4c70
6 changed files with 282 additions and 65 deletions

View File

@@ -12,8 +12,9 @@ class Projector:
EPSG_WGS_84 = "epsg:4326"
EPSG_Xian_1980_105E = "epsg:4507"
EPSG_CGCS_2000_105E = "epsg:4507"
EPSG_CGCS_2000_108E = "epsg:4545"
EPSG_Xian_1980_114E = "epsg:2383"
# _transformer_84_yx = Transformer.from_crs("epsg:4326", "epsg:4507")
# _transformer_yx_84 = Transformer.from_crs("epsg:4507", "epsg:4326")

View File

@@ -16,17 +16,15 @@ def prettify(elem):
def main():
df = pd.read_excel("成果表-0120.xlsx")
needed_df = df.iloc[:120, :3]
trans = transformer.Projector(
transformer.EPSG_CGCS_2000_108E, transformer.EPSG_WGS_84
)
y_array = needed_df["北坐标(m)"].to_numpy()
x_array = needed_df["东坐标(m)"].to_numpy()
df = pd.read_excel("杆塔成果表(左侧)-复测.xls")
needed_df = df.iloc[:85, :]
trans = transformer.Projector(transformer.EPSG_Xian_1980_114E, transformer.EPSG_WGS_84)
y_array = needed_df["北坐标"].to_numpy()
x_array = needed_df["东坐标"].to_numpy()
yx_array = np.array([y_array, x_array]).transpose()
wgs_84_point = np.array([trans.transform(y, x) for y, x in yx_array])
name_lat_lon_df = pd.DataFrame(
{"桩号": needed_df["点号"], "纬度": wgs_84_point[:, 0], "经度": wgs_84_point[:, 1]}
{"桩号": needed_df["杆塔"], "纬度": wgs_84_point[:, 0], "经度": wgs_84_point[:, 1]}
)
ET.register_namespace("", "http://www.opengis.net/kml/2.2")
ns = {
@@ -61,5 +59,5 @@ def main():
"{lon},{lat},{elevation}".format(lon=foo[1], lat=foo[0], elevation=foo[2])
for foo in line_coordination_list
)
with open("out.kml", "w", encoding="utf-8") as f:
with open("周口.kml", "w", encoding="utf-8") as f:
f.write(prettify(xml_root).decode("utf-8"))