def test_image_matrix(station_names): data = get_image_matrix() fc = FeatureCollection() for n in station_names: x, y = get_xy(n) fc.add_polygon(rbs.get_poly(x, y), dict(weight=data[x][y], name=n)) # So that scale is from 0 to 1 fc.add_polygon(rbs.get_poly(100, 100), dict(weight=0)) fc.dump('tmp1.geojson')
def test_image_matrix(station_names): data = get_image_matrix() fc = FeatureCollection() for n in station_names: x, y = get_xy(n) fc.add_polygon(rbs.get_poly(x, y), dict(weight=data[x][y], name=n)) # So that scale is from 0 to 1 fc.add_polygon(rbs.get_poly(100, 100), dict(weight=0)) fc.dump('tmp1.geojson')
def get_avail(name): x, y = get_xy(name) return data[x][y]
def draw_rates(filename): fc = FeatureCollection() rates = pickle.load(open(filename))['rates'] for weight, station in zip(rates, sio.loadmat(MAT_FILE)['stations']): fc.add_polygon(rbs.get_poly(*get_xy(station)), {'weight': weight}) fc.dump('rates.geojson')
def draw_rates(filename): fc = FeatureCollection() rates = pickle.load(open(filename))['rates'] for weight, station in zip(rates, sio.loadmat(MAT_FILE)['stations']): fc.add_polygon(rbs.get_poly(*get_xy(station)), {'weight': weight}) fc.dump('rates.geojson')
def get_avail(name): x, y = get_xy(name) return data[x][y]