예제 #1
0
파일: place.py 프로젝트: OmerKa/Bus
def find(lat,lon, acc):
    stime = time.time()
    sql = 'select * from shapes'
    l = db.Query(sql)
    print 'findTrips'
    res = set()
    for row in l:
        dis = d((lat,lon),(row[0],row[1])).meters
        if dis <= acc:
            print 'o'
            dis = d((lat,lon),(row[2],row[3])).meters
            if dis <= acc:
                print 'k'
                for shape in row[4].split(';'):
                    res.add(int(shape))
    print time.time()-stime
    return db.get_trips_ids('shape_id',res)
예제 #2
0
def find_old(lat, lon, acc):
    acc = int(float(acc))
    stime = time.time()
    sql = 'select * from distinct_new_shapes'
    #sql = 'select * from new_shape'
    l = db.Query(sql)
    print 'findTrips'
    res = set()
    for row in l:
        dis = d((lat, lon), (row[0], row[1])).meters
        if dis <= acc:
            print 'o'
            dis = d((lat, lon), (row[2], row[3])).meters
            if dis <= acc:
                print 'k'
                if type(row[4]) == type(1):
                    res.add(row[4])
                else:
                    for shape in row[4].split(';'):
                        res.add(int(shape))
    print time.time() - stime
    print len(res)
    return db.get_trips_ids('shape_id', res)
예제 #3
0
파일: place.py 프로젝트: TravelCube/BusLib
def find_old(lat,lon, acc):
    acc = int(float(acc))
    stime = time.time()
    sql = 'select * from distinct_new_shapes'
    #sql = 'select * from new_shape'
    l = db.Query(sql)
    print 'findTrips'
    res = set()
    for row in l:
        dis = d((lat,lon),(row[0],row[1])).meters
        if dis <= acc:
            print 'o'
            dis = d((lat,lon),(row[2],row[3])).meters
            if dis <= acc:
                print 'k'
                if type(row[4]) == type(1):
                    res.add(row[4])
                else:
                    for shape in row[4].split(';'):
                        res.add(int(shape))
    print time.time()-stime
    print len(res)
    return db.get_trips_ids('shape_id',res)
예제 #4
0
파일: routs.py 프로젝트: OmerKa/Bus
def find(bus_line):
    sql = 'select id from routes where bus_num = {0}'.format(bus_line)
    ids = db.First(db.Query(sql))
    return db.get_trips_ids('route_id',ids)
예제 #5
0
def find_all(day):
    sql = 'select service_id from calendar where {0} = 1'.format(day)
    return db.get_trips_ids('service_id', db.First(db.Query(sql)))
예제 #6
0
def find_all(day):
    sql = 'select service_id from calendar where {0} = 1'.format(day)
    return db.get_trips_ids('service_id',db.First(db.Query(sql)))