示例#1
0
文件: views.py 项目: haum/timeoAPI
def station_coords(code):
    result  = {}
    result['type'] = "station_coords"
    result['code'] = code
    coords = meta.coords(code)
    result['coords'] = [coords['lat'], coords['lon']]
    return jsondump(result)
示例#2
0
文件: views.py 项目: haum/timeoAPI
def station_allmeta(code):
    result = {}
    result['type'] = 'station_metadata'
    result['code'] = code
    coords = meta.coords(code)
    result['coords'] = [coords['lat'], coords['lon']]
    result['properties'] = meta.properties(code)
    return jsondump(result)
示例#3
0
文件: views.py 项目: haum/timeoAPI
def lines_stations(lignesens):

    # TODO: A améliorer
    t = Timeo()
    result = {}
    result['type'] = 'line_stations'
    result['stations'] = t.getall_arrets(lignesens)

    coords = meta.coords(list(result['stations'].keys()))
    if not set(result['stations'].keys()) == set(coords.keys()):
        for i in set(result['stations'].keys())-set(coords.keys()):
            coords[i] = []
    for code in result['stations'].keys():
        result['stations'][code] = {
            'coords': coords[code],
            'name': result['stations'][code]
        }

    return jsondump(result)