Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
A
auto_join_edge
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
xuebingbing
auto_join_edge
Commits
e0c51e5d
Commit
e0c51e5d
authored
Jun 18, 2020
by
xiongchao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复道路边缘相关的bugg
parent
95614a8c
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
20 deletions
+25
-20
connect_mesh.py
connect_solution/connect_mesh.py
+0
-0
main.py
main.py
+19
-17
common.py
util/common.py
+3
-3
const.py
util/const.py
+3
-0
No files found.
connect_solution/connect_mesh.py
View file @
e0c51e5d
This diff is collapsed.
Click to expand it.
main.py
View file @
e0c51e5d
...
@@ -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
)
util/common.py
View file @
e0c51e5d
...
@@ -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.00000
0
1
# 单位米,如果是度的话,请进行转换
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
...
...
util/const.py
View file @
e0c51e5d
...
@@ -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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment