Commit e0c51e5d authored by xiongchao's avatar xiongchao

修复道路边缘相关的bugg

parent 95614a8c
This diff is collapsed.
...@@ -128,7 +128,7 @@ def run(connect_postgresql, sheet_designation_path, mesh_box_path, output_docume ...@@ -128,7 +128,7 @@ def run(connect_postgresql, sheet_designation_path, mesh_box_path, output_docume
output_info1.append(output_info) output_info1.append(output_info)
write_info(output_document_path, output_info1, output_info2, output_info3) write_info(output_document_path, output_info1, output_info2, output_info3)
return return
mesh_box_data_source = ogr.Open(mesh_box_path, 0) mesh_box_data_source = ogr.Open(mesh_box_path, 1)
if mesh_box_data_source is None: if mesh_box_data_source is None:
output_info = "图幅框文件中没有任何数据,请确认后重试!" output_info = "图幅框文件中没有任何数据,请确认后重试!"
output_info1.append(output_info) output_info1.append(output_info)
...@@ -210,21 +210,23 @@ def run(connect_postgresql, sheet_designation_path, mesh_box_path, output_docume ...@@ -210,21 +210,23 @@ def run(connect_postgresql, sheet_designation_path, mesh_box_path, output_docume
if __name__ == '__main__': if __name__ == '__main__':
arg1 = r"PG:dbname='test3' host='localhost' port='5432' user='postgres' password='19931018'" # arg1 = r"PG:dbname='test12' host='localhost' port='5432' user='postgres' password='19931018'"
arg2 = r"C:\Users\熊超\Desktop\edge_match_file\mesh_ids.txt" # # arg1 = r"PG:dbname='qgis_hb_sync' host='win-1.corp.roadlinks.cn' port='5432' user='postgres' password='juefx0123'"
arg3 = r"C:\Users\熊超\Desktop\edge_match_file\mesh_grid.gpkg" # arg2 = r"C:\Users\熊超\Desktop\edge_match_file\mesh_ids.txt"
arg4 = r"C:\Users\熊超\Desktop\edge_match_file" # # arg3 = r"C:\Users\熊超\Desktop\edge_match_file\mesh_grid.gpkg"
run(arg1, arg2, arg3, arg4) # arg3 = r"C:\Users\熊超\Desktop\new1\gps_grids.gpkg"
# arg1, arg2, arg3, arg4 = None, None, None, None # arg4 = r"C:\Users\熊超\Desktop\edge_match_file"
# try:
# arg1 = sys.argv[1] # 数据库连接字符串
# arg2 = sys.argv[2] # 图幅号的txt文件
# arg3 = sys.argv[3] # 图幅框文件
# arg4 = sys.argv[4] # 接边报表路径
# current_path = os.path.dirname(os.path.abspath(__file__))
# gdal_data = current_path + '\\proj'
# osr.SetPROJSearchPath(gdal_data)
# except Exception as e:
# print("传入的参数有问题,程序发生异常,异常为:" + str(e))
# run(arg1, arg2, arg3, arg4) # run(arg1, arg2, arg3, arg4)
arg1, arg2, arg3, arg4 = None, None, None, None
try:
arg1 = sys.argv[1] # 数据库连接字符串
arg2 = sys.argv[2] # 图幅号的txt文件
arg3 = sys.argv[3] # 图幅框文件
arg4 = sys.argv[4] # 接边报表路径
current_path = os.path.dirname(os.path.abspath(__file__))
gdal_data = current_path + '\\proj'
osr.SetPROJSearchPath(gdal_data)
except Exception as e:
print("传入的参数有问题,程序发生异常,异常为:" + str(e))
run(arg1, arg2, arg3, arg4)
...@@ -8,7 +8,7 @@ import numpy as np ...@@ -8,7 +8,7 @@ import numpy as np
from sklearn.neighbors import KDTree from sklearn.neighbors import KDTree
DEF_ALPHA = 0.0000001 # 单位米,如果是度的话,请进行转换 DEF_ALPHA = 0.000001 # 单位米,如果是度的话,请进行转换
def two_point_distance_2d(point1, point2): def two_point_distance_2d(point1, point2):
...@@ -69,9 +69,9 @@ def is_same_point_2d(point1, point2): ...@@ -69,9 +69,9 @@ def is_same_point_2d(point1, point2):
return False return False
def is_same_point_3d(point1, point2): def is_same_point_3d(point1, point2, alpha=DEF_ALPHA):
# 判断两个点是不是一个点,选择x, y, z # 判断两个点是不是一个点,选择x, y, z
flag = np.array([np.abs(point1[i] - point2[i]) < DEF_ALPHA for i in range(len(point1))]) flag = np.array([np.abs(point1[i] - point2[i]) < alpha for i in range(len(point1))])
if flag.all(): if flag.all():
return True return True
return False return False
......
...@@ -85,5 +85,8 @@ c.CONNECT_THRESHOLD = 2 # 除了参考线之外,需要连接的两天线之 ...@@ -85,5 +85,8 @@ c.CONNECT_THRESHOLD = 2 # 除了参考线之外,需要连接的两天线之
c.LANE_EDGE_NODE_ID = "LANE_EDGE_NODE_ID" # 边界线节点的主键 c.LANE_EDGE_NODE_ID = "LANE_EDGE_NODE_ID" # 边界线节点的主键
c.LANE_NODE_ID = "LANE_NODE_ID" # 中心线节点的主键 c.LANE_NODE_ID = "LANE_NODE_ID" # 中心线节点的主键
c.LINK_EDGE_NODE_ID = "LINK_EDGE_NODE_ID" # 道路边缘节点的主键 c.LINK_EDGE_NODE_ID = "LINK_EDGE_NODE_ID" # 道路边缘节点的主键
c.LINK_IDS = "LINK_IDS" # 参考线节点关联得参考线id
c.LANE_IDS = "LANE_IDS" # 中心线节点关联的中心线id
c.EDGE_IDS = "EDGE_IDS" # 边界线/道路边缘节点关联的边界线/道路边缘的id
sys.modules[__name__] = c sys.modules[__name__] = c
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment