Skip to content

Commit

Permalink
feat: get correct node list (WIP)
Browse files Browse the repository at this point in the history
好消息:终于全都转换成点了
坏消息:我们无法从路径中读取到它和原来点的映射,全都要重建,而且路径也不一定能匹配到真正的路径的ID

比如243740044的ID就是正确的,对应OSM同ID的路径,但是-3295824的ID应为1163606761,我们也不知道osm2pgsql怎么搞的幺蛾子
  • Loading branch information
LaoshuBaby committed Feb 24, 2024
1 parent 4055ac3 commit 49920b2
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions src/yuheng/plugin/driver_db_postgresql/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
current_dir = os.path.dirname(os.path.realpath(__file__))
src_dir = os.path.join(current_dir, "..", "..", "..")
sys.path.append(src_dir)
from yuheng import Waifu
from yuheng import Waifu, Node


def check():
Expand Down Expand Up @@ -129,7 +129,10 @@ def get_data(
print("要么你就想查询line/point以外的表,要么你就输了太多项。目前无法支持。")
return None
print("len(result)", "=", len(result)) # debug
node_remap_count = -1
way_remap_count = -1
count = 0
map = Waifu()
for element in result:
count += 1
element_type = element[0]
Expand All @@ -139,24 +142,22 @@ def get_data(
column = columns[0]
attrib = dict(zip(column, element_data))
geom = attrib["way"]
# print(attrib) # debug
# print(geom) # debug
print(attrib) # debug
print(geom) # debug
if isinstance(geom, shapely.geometry.Point):
print("yoo")
print(geom.x, geom.y)
print(geoproj(geom.x, geom.y))
if count >= 500:
exit(0)
if isinstance(geom, shapely.geometry.LineString):
print(type(geom), geom)
# print(type(geom.xy), geom.xy)
# print(type(geom.xy[0]), geom.xy[0])
# print(type(list(geom.xy[0])), list(geom.xy[0]))
print(list(zip(list(geom.xy[0]), list(geom.xy[1]))))
# for i in geom:
# print(i)
if count >= 2:
exit(0)
point_list = [
geoproj(x=i[0], y=i[1])
for i in list(zip(list(geom.xy[0]), list(geom.xy[1])))
]
temp_node = Node()
if count >= 3:
exit(1)

return result

Expand Down

0 comments on commit 49920b2

Please sign in to comment.