Exemple #1
0
def dfpoints(df, x_col, y_col, uuid=None, **kwargs):
    """
    Generate a tileset that serves 2d labelled points from a pandas
    dataframe.

    Parameters
    ----------
    df: :class:`pandas.DataFrame`
        The dataframe containining the data
    x_col: str
        The name of the column containing the x-coordinates
    y_col: str
        The name of the column containing the y-coordinates
    uuid: str
        The uuid of this tileset

    Returns
    -------
    A tileset capapble of serving tiles from this dataframe.

    """
    from clodius.tiles.points import tileset_info, tiles, format_data

    tsinfo = tileset_info(df, x_col, y_col)
    tiles_fn = lambda z, x, y, width=1, height=1: tiles(
        df, x_col, y_col, tsinfo, z, x, y, width, height)

    return Tileset(uuid=uuid,
                   tileset_info=lambda: tsinfo,
                   tiles=lambda tile_ids: format_data(
                       bundled_tiles_wrapper_2d(tile_ids, tiles_fn)),
                   datatype="scatter-point",
                   **kwargs)
Exemple #2
0
def test_bundled_tiles():
    filename = 'data/points_density.h5'

    tiles = hgut.bundled_tiles_wrapper_2d(['c.2.0.0', 'c.2.1.1', 'c.2.0.1', 'c.2.1.0'],
       ft.partial(hgde.tiles, filename)) 
    assert(len(tiles) == 4)
    return
Exemple #3
0
def test_bundled_tiles():
    filename = "data/points_density.h5"

    tiles = hgut.bundled_tiles_wrapper_2d(
        ["c.2.0.0", "c.2.1.1", "c.2.0.1", "c.2.1.0"],
        ft.partial(hgde.tiles, filename))
    assert len(tiles) == 4