Ejemplo n.º 1
0
def glui(
    path,
    bidx,
    scale,
    colormap,
    tiles_format,
    tiles_dimensions,
    nodata,
    gl_tile_size,
    port,
    playground,
    mapbox_token,
):
    """Rasterio glui cli."""
    if scale and len(scale) not in [1, 3]:
        raise click.ClickException("Invalid number of scale values")

    raster = RasterTiles(path,
                         indexes=bidx,
                         tiles_size=tiles_dimensions,
                         nodata=nodata)

    app = server.TileServer(
        raster,
        scale=scale,
        colormap=colormap,
        tiles_format=tiles_format,
        gl_tiles_size=gl_tile_size,
        gl_tiles_minzoom=raster.get_min_zoom(),
        gl_tiles_maxzoom=raster.get_max_zoom(),
        port=port,
    )

    if playground:
        url = app.get_playground_url()
    else:
        url = app.get_template_url()

    if mapbox_token:
        url = "{}?access_token={}".format(url, mapbox_token)

    click.launch(url)
    click.echo("Inspecting {} at {}".format(path, url), err=True)
    app.start()
Ejemplo n.º 2
0
def glui(
    path,
    bidx,
    tiles_format,
    tiles_dimensions,
    nodata,
    gl_tile_size,
    port,
    playground,
    mapbox_token,
):
    """Rasterio glui cli."""
    raster = RasterTiles(path,
                         indexes=bidx,
                         tiles_size=tiles_dimensions,
                         nodata=nodata)

    app = server.TileServer(
        raster,
        tiles_format=tiles_format,
        gl_tiles_size=gl_tile_size,
        gl_tiles_minzoom=raster.get_min_zoom(),
        gl_tiles_maxzoom=raster.get_max_zoom(),
        port=port,
    )

    if playground:
        url = app.get_playround_url()
    else:
        url = app.get_template_url()

    if mapbox_token:
        url = "{}?access_token={}".format(url, mapbox_token)

    click.launch(url)
    click.echo("Inspecting {} at {}".format(path, url), err=True)
    app.start()
Ejemplo n.º 3
0
def test_rastertiles_get_min_zoom():
    """Should work as expected (create rastertiles object and get_min_zoom)."""
    r = RasterTiles(raster_path)
    assert r.get_min_zoom() == 12