• 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
first commit of refactoring of data transaction - gps data, attempt to fix problems that 1. data being sent too often, 2. in previous method, the data insert operation happens too often. this commit is trying to fix it by 1. data being sent every 15sec (or more) not every sec, 2. reformatted gps data so that data transaction will cost a lot less bandwidth and 3. insertion operation has been replaced with copy, which is more apt for bulk row appendage operation.
2024-07-17
logger
Hello Yona
2024-07-09
README.md
Hello Yona
2024-07-09
action.py
first commit of refactoring of data transaction - gps data, attempt to fix problems that 1. data being sent too often, 2. in previous method, the data insert operation happens too often. this commit is trying to fix it by 1. data being sent every 15sec (or more) not every sec, 2. reformatted gps data so that data transaction will cost a lot less bandwidth and 3. insertion operation has been replaced with copy, which is more apt for bulk row appendage operation.
2024-07-17
app.py
Hello Yona
2024-07-09
auth.py
added json communication format
2024-07-17
blocked_ips.json
Hello Yona
2024-07-09
example.json
added json communication format
2024-07-17
gcity.py
Hello Yona
2024-07-09
requirements.txt
Hello Yona
2024-07-09
trip.py
Hello Yona
2024-07-09
minipc 2024-07-09 b31a01e 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