def rf(l): imp_waypts=[] listimp=[] a='' b=[] i=0 flag=0 route_list=[] list_values=[] lat_a=0.0 lat_d=0.0 lng_a=0.0 lng_d=0.0 lat_a,lng_a,lat_d,lng_d = checker(l) list_values = l address = gmaps.latlng_to_address(lat_a,lng_a) print address destination = gmaps.latlng_to_address(lat_d,lng_d) print destination directions = gmaps.directions(address, destination) for step in directions['Directions']['Routes'][0]['Steps']: a=step['descriptionHtml'] route_list.append(a) print '\n\n****Route Calculated****\n\n' route_distance=0.0 route_distance= (directions['Directions']['Distance']['meters']/1000.0) print 'Total Distance is :',route_distance,'km' route_time=0.0 route_time=(directions['Directions']['Duration']['seconds']/60.0) print 'Total Time is :',route_time,'min' i=0 for i in route_list: rightfare_func.keywrd_lift(i) rightfare_func.keywrd_remove() imp_waypts=rightfare_func.giv_value() print '\n\nThe Route to be Followed is \n\n:' rightfare_func.print_route(route_list) imp_waypts = rightfare_func.red(imp_waypts) print '\n\n****Important Waypoints****\n\n' for i in imp_waypts: print i fare=rightfare_func.calc_fare(route_distance) print "\n\n\n Total fare is: ",fare rightfare_func.file_avg(list_values[1],list_values[2]) rightfare_func.get_file(fare,'0',list_values[0],list_values[1],list_values[2],route_distance,imp_waypts) str_waypts=rightfare_func.cnvrt(imp_waypts) src=list_values[1][:-9] dst=list_values[2][:-9] sample1.insertdistance(src,dst,str_waypts,route_distance,'0',fare,0)
def rf(l): imp_waypts=[] # Will hold the Important waypoints from my Route List listimp=[] a='' b=[] i=0 flag = 0 route_list=[] # Holds the fetched data about the route list_values=[] #holds the values to be input in sequence from number , source , destination lat_a=0.0#lat of address lat_d=0.0#lat of destination lng_a=0.0 lng_d=0.0 lat_a,lng_a,lat_d,lng_d = checker(l) #variable definition ends #list_values = read_file() list_values = l address = list_values[1] destination = list_values[2] #lat_a,lng_a = gmaps.address_to_latlng(address) #print lat_a,lng_a address = gmaps.latlng_to_address(lat_a,lng_a) print address #destination = destination + ',New Delhi ,India' #lat_d,lng_d = gmaps.address_to_latlng(destination) #print lat_d,lng_d destination = gmaps.latlng_to_address(lat_d,lng_d) print destination directions = gmaps.directions(address, destination) #print directions for step in directions['Directions']['Routes'][0]['Steps']: a=step['descriptionHtml'] route_list.append(a) #for i in listtemp: # print i print '\n\n****Route Calculated****\n\n' route_distance=0.0 route_distance= (directions['Directions']['Distance']['meters']/1000.0) print 'Total Distance is :',route_distance,'km' route_time=0.0 route_time=(directions['Directions']['Duration']['seconds']/60.0) print 'Total Time is :',route_time,'min' i=0 for i in route_list: rightfare_func.keywrd_lift(i) rightfare_func.keywrd_remove() #imp_waypts=rightfare_func.giv_value() #for i in imp_waypts: # print i #rightfare_func.remove_doubling() imp_waypts=rightfare_func.giv_value() print '\n\nThe Route to be Followed is \n\n:' rightfare_func.print_route(route_list) print '\n\n****Important Waypoints****\n\n' for i in imp_waypts: print i fare=rightfare_func.calc_fare(route_distance) print "\n\n\n Total fare is: ",fare rightfare_func.file_avg(list_values[1],list_values[2]) imp_waypts = rightfare_func.red(imp_waypts) '''n = len(imp_waypts) for i in range(0,n): imp_waypts[i]=rightfare_func.rem_vowels1(imp_waypts[i])''' rightfare_func.get_file(fare,'0',list_values[0],list_values[1],list_values[2],route_distance,imp_waypts) str_waypts=rightfare_func.cnvrt(imp_waypts) sample1.insertdistance(list_values[1],list_values[2],str_waypts,route_distance,'0',fare,0)
print '\n\n****Route Calculated****\n\n' route_distance=0.0 route_distance= (directions['Directions']['Distance']['meters']/1000.0) print 'Total Distance is :',route_distance,'km' route_time=0.0 route_time=(directions['Directions']['Duration']['seconds']/60.0) print 'Total Time is :',route_time,'min' i=0 for i in route_list: rightfare_func.keywrd_lift(i) rightfare_func.keywrd_remove() #imp_waypts=rightfare_func.giv_value() #for i in imp_waypts: # print i #rightfare_func.remove_doubling() imp_waypts=rightfare_func.giv_value() print '\n\nThe Route to be Followed is \n\n:' rightfare_func.print_route(route_list) print '\n\n****Important Waypoints****\n\n' for i in imp_waypts: print i fare=rightfare_func.calc_fare(route_distance) print "\n\n\n Total fare is: ",fare rightfare_func.file_avg(list_values[1],list_values[2]) imp_waypts = rightfare_func.red(imp_waypts) n = len(imp_waypts) for i in range(0,n): imp_waypts[i]=rightfare_func.rem_vowels1(imp_waypts[i]) print imp_waypts rightfare_func.get_file(fare,'0',list_values[0],list_values[1],list_values[2],route_distance,imp_waypts) str_waypts=rightfare_func.cnvrt(imp_waypts)