Exemplo n.º 1
0
def mm(tid, method, interval=1):
    alg = algs[method]

    gw = cg.new_gw()
    trd = cdb.new_track_reader(offset=0)
    pwd = cdb.new_path_writer_for_method(method=method)
    pt2j = cj.new_pt2geojson(method=method)

    track = trd.fetch_by_id(tid)
    track.sample(interval)
    track.summary()
    pt2j.write_t_geojson(track)

    alg.prepare(gw)

    path = alg.match(gw, track)

    pt2j.write_p_geojson(path)

    # pwd.insert_update(path)

    path.summary()

    del trd, pwd

    return path
Exemplo n.º 2
0
def mm(tid, method, interval=1):
    alg = algs[method]

    gw = cg.new_gw()
    trd = cdb.new_track_reader(offset = 0)
    pwd = cdb.new_path_writer_for_method(method = method)
    pt2j = cj.new_pt2geojson(method = method)

    track = trd.fetch_by_id(tid)
    track.sample(interval)
    track.summary()
    pt2j.write_t_geojson(track)

    alg.prepare(gw)

    path = alg.match(gw, track)

    pt2j.write_p_geojson(path)

    # pwd.insert_update(path)

    path.summary()

    del trd,pwd

    return path
Exemplo n.º 3
0
def mm(gw, trd, method, tid, interval):

    alg = algs[method]

    pt2j = cj.new_pt2geojson(method = method)

    track = trd.fetch_by_id(tid)
    track.sample(interval)
    #pt2j.write_t_geojson(track)

    path = alg.match(gw, track)
 
    pt2j.write_p_geojson(path)

    return path
Exemplo n.º 4
0
def mm(gw, trd, method, tid, interval):

    alg = algs[method]

    pt2j = cj.new_pt2geojson(method=method)

    track = trd.fetch_by_id(tid)
    track.sample(interval)
    #pt2j.write_t_geojson(track)

    path = alg.match(gw, track)

    pt2j.write_p_geojson(path)

    return path
# There are 2638410 tracks in table taxi_tracks, id from 1-2638410
TRACKS_FROM_TID = 1
TRACKS_TO_TID = 2638410

TID_DP_TBNAME = "taxi_tid_dp_1"

METHOD = 'bn'
alg = abn

gw = cg.new_gw()
trd = cdb.new_track_reader_for_purpose(purpose="mm")
pwd = cdb.new_path_writer_for_method(method = METHOD)
pawd = cdb.new_path_attr_writer_for_method(method = METHOD)
tdpdb = cdb.new_tid_dp_db(tbname=TID_DP_TBNAME)
pt2j = cj.new_pt2geojson(method = METHOD)

req_nodes = [19808,12055,19800,19943,28533,19804,19801,23737,23736,23739]

def rect_of_nodes(nodes, r=1):
    latgap = cg.km2latgap(r)
    longap = cg.km2longap(r, 39.0)
    min_lon = INF
    min_lat = INF
    max_lon = -INF
    max_lat = -INF
    for v in nodes:
        (lon, lat) = gw.nodes_pos[v]
        min_lon = min(min_lon, lon)
        max_lon = max(max_lon, lon)
        min_lat = min(min_lat, lat)
# There are 2638410 tracks in table taxi_tracks, id from 1-2638410
TRACKS_FROM_TID = 1
TRACKS_TO_TID = 2638410

TID_DP_TBNAME = "taxi_tid_dp_1"

METHOD = 'bn'
alg = abn

gw = cg.new_gw()
trd = cdb.new_track_reader_for_purpose(purpose="mm")
pwd = cdb.new_path_writer_for_method(method=METHOD)
pawd = cdb.new_path_attr_writer_for_method(method=METHOD)
tdpdb = cdb.new_tid_dp_db(tbname=TID_DP_TBNAME)
pt2j = cj.new_pt2geojson(method=METHOD)

req_nodes = [
    19808, 12055, 19800, 19943, 28533, 19804, 19801, 23737, 23736, 23739
]


def rect_of_nodes(nodes, r=1):
    latgap = cg.km2latgap(r)
    longap = cg.km2longap(r, 39.0)
    min_lon = INF
    min_lat = INF
    max_lon = -INF
    max_lat = -INF
    for v in nodes:
        (lon, lat) = gw.nodes_pos[v]