Esempio n. 1
0
#!/usr/bin/env python
import data_mall
import json
import os

data_mall.authenticate(os.environ['DATA_MALL_API_TOKEN'])

bus_stops = data_mall.get('BusStops', 0)

json.dump(bus_stops, open('bus_stops_from_data_mall.json', 'w'), indent=2)
#!/usr/bin/env python
import data_mall
import json
import os

data_mall.authenticate(os.environ.get('DATA_MALL_API_TOKEN'))

bus_routes = data_mall.get('BusRoutes', 0)

json.dump(bus_routes, open('bus_routes_from_data_mall.json', 'w'), indent=2)
Esempio n. 3
0
            if len(obj['SearchResults']) == 1:
                break

            data = data + obj['SearchResults'][1:]
            print len(obj['SearchResults'])
            rset += 1

    return data


# This is the one map data, but it is missing the Malaysian bus stops
data = download_stuff()

# Download stops from data mall
data_mall.authenticate('1hMEqSwhQWWRo88SupMVzQ==',
                       '6b2ffab0-5916-4a20-a0d7-8f9824627d7b')
dm_data = data_mall.get('BusStops', 0)
dm_data = [d for d in dm_data if d['Longitude'] != 0]
dm_data = [
    d for d in dm_data if re.match('[0-9]{5}', d['BusStopCode']) != None
]

for d in dm_data:
    X, Y = svy21(d['Longitude'], d['Latitude'])
    data.append({
        'SEARCHVAL': '%s (BUS STOP)' % (d['BusStopCode']),
        'X': X,
        'Y': Y
    })

# Save the pickle file