• Y
  • List All
  • Feedback
    • This Project
    • All Projects
Profile Account settings Log out
  • Favorite
  • Project
  • All
Loading...
  • Log in
  • Sign up
yjyoon / Daegu-Jeju-DIP star
  • Project homeH
  • CodeC
  • IssueI
  • Pull requestP
  • Review R
  • MilestoneM
  • BoardB 1
  • Files
  • Commit
  • Branches
Daegu-Jeju-DIPgcity.py
Download as .zip file
File name
Commit message
Commit date
database
rebulding server
2024-09-09
logger
Hello Yona
2024-07-09
.gitignore
massive modification, this is the part where DB gets cryptography, extended functionality support for the application
2024-09-06
README.md
Hello Yona
2024-07-09
action.py
rebulding server
2024-09-09
app.py
massive modification, this is the part where DB gets cryptography, extended functionality support for the application
2024-09-06
auth.py
rebulding server
2024-09-09
blocked_ips.json
Hello Yona
2024-07-09
example.json
added json communication format
2024-07-17
gcity.py
Hello Yona
2024-07-09
unit_test_insert_gps_command.sh
added another boundary condition : this is for when the data itself is incomplete, where its missing some one or two data
2024-07-17
minipc 2024-07-09 2fdc43c Hello Yona DOS
Raw Open in browser Change history
import networkx as nx import math from itertools import tee from numpy import Inf, Infinity, inf from database.database import DB import pandas as pd from haversine import haversine import time import pandas as pd import os paths= os.getcwd() def dist(a, b): (x1, y1) = a (x2, y2) = b return ((x1 - x2) ** 2 + (y1 - y2) ** 2) ** 0.5 def swith_xy(tuples): x,y=tuples return (y,x) def pairwise( iterable ): """Returns an iterable access binary tuple s -> (s0,s1), (s1,s2), (s2, s3), ...""" a, b = tee( iterable ) next(b, None) return zip(a, b) class path_finder(): def __init__(self): start_time=time.time() self.db=DB() self.G=nx.read_gpickle(paths + '\\navigation_model\\OSM_gpickle.gpickle') print("done") print(time.time()-start_time) def get_trip(self,dest1,dest2): start_time=time.time() dest1=swith_xy(self.db.db_get_dest(dest1)) dest2=swith_xy(self.db.db_get_dest(dest2)) value=0.0001 start_near_nodes=[] while start_near_nodes == []: value=value*10 start_near_nodes=self.db.db_get_near_node(dest1[1],dest1[0],value) else: start_near_nodes=self.db.db_get_near_node(dest1[1],dest1[0],value) nn_start = None nn_end = None start_delta = float("inf") end_delta = float("inf") for n in start_near_nodes: s_dist = haversine(dest1, n) if s_dist < start_delta : nn_start = n start_delta = s_dist value=0.0001 end_near_nodes=[] while end_near_nodes==[]: value=value*10 self.db.db_get_near_node(dest2[1],dest2[0],value) end_near_nodes=self.db.db_get_near_node(dest2[1],dest2[0],value) for n in end_near_nodes: e_dist = haversine(dest2, n) if e_dist < end_delta : nn_end = n end_delta = e_dist path = list(nx.astar_path(self.G,nn_start,nn_end,heuristic=dist,weight='length')) return path def get_dest(self, dest1): dest1=swith_xy(self.db.db_get_address(dest1)) return dest1 db=DB() df = pd.read_csv('D:\\takensoft\\project2\\경산 길찾기\\경산시_체크.csv',encoding='euc-kr') li_start=[] li_dest1=[] for i in range(len(df)): try: print(i) dest1=df['start'][i] li_dest1.append(dest1) dest1=swith_xy(db.db_get_dest(dest1)) value=0.0001 start_near_nodes=[] while start_near_nodes == []: value=value*10 start_near_nodes=db.db_get_near_node(dest1[1],dest1[0],value) nn_start = None start_delta = float("inf") for n in start_near_nodes: s_dist = haversine(dest1, n) if s_dist < start_delta : nn_start = n start_delta = s_dist li_start.append(nn_start) except: continue df_check=pd.DataFrame({'start':li_dest1,'시작지점':li_start}) df_check.to_csv('test.csv',encoding='euc-kr') ''' df=pd.read_csv('D:\\takensoft\\project2\\경산 길찾기\\경산시.csv',encoding='euc-kr') p=path_finder() li_path=[] for i in range(len(df)): try: if i%100 ==0: print(i) df2=pd.DataFrame(li_path) df2.to_csv(f'D:\\takensoft\\project2\\경산 길찾기\\길찾기 결과{i}.csv',encoding='euc-kr') li_path=[] start=df['start'][i] end=df['end'][i] li_path.append(p.get_trip(start,end)) except: continue li_start_x = [] li_start_y = [] li_end_x = [] li_end_y = [] db=DB() #df.to_csv('D:\\takensoft\\project2\\경산 길찾기\\길찾기 결과.csv',encoding='euc-kr') df=pd.read_csv('D:\\takensoft\\project2\\경산 길찾기\\경산시.csv',encoding='euc-kr') for i in range(len(df)): li_start_x.append(db.db_get_dest(df['start'][i])[0]) li_start_y.append(db.db_get_dest(df['start'][i])[1]) li_end_x.append(db.db_get_dest(df['end'][i])[0]) li_end_y.append([db.db_get_dest(df['end'][i])[1]]) df2 = pd.DataFrame({'start_point_x':li_start_x,'start_point_y':li_start_y,'end_point_x':li_end_x,'end_point_y':li_end_y}) df2.to_csv('D:\\takensoft\\project2\\경산 길찾기\\출발지도착지좌표.csv',encoding='euc-kr') '''

          
        
    
    
Copyright Yona authors & © NAVER Corp. & NAVER LABS Supported by NAVER CLOUD PLATFORM

or
Sign in with github login with Google Sign in with Google
Reset password | Sign up