Пример #1
0
def materialize_tilespec_image(tilespec,
                               out_fn=None,
                               height=None,
                               width=None,
                               x=None,
                               y=None,
                               res=32,
                               subprocess_mode=None,
                               client_script=None,
                               memGB=None,
                               render=None,
                               **kwargs):
    tspecfile = renderdump_temp([tilespec])

    x = _defaultval(x, tilespec.minX)
    y = _defaultval(y, tilespec.minY)
    width = _defaultval(width, int(float((tilespec.maxX - tilespec.minX))))
    height = _defaultval(height, int(float((tilespec.maxY - tilespec.minY))))
    renderClient(tile_spec_url=tspecfile,
                 out_fn=out_fn,
                 height=height,
                 width=width,
                 x=x,
                 y=y,
                 res=res,
                 subprocess_mode=subprocess_mode,
                 client_script=client_script,
                 memGB=memGB,
                 **kwargs)

    os.remove(tspecfile)
Пример #2
0
def materialize_renderparameters_image(
        obj, out_fn=None, subprocess_mode=None, client_script=None, memGB=None,
        render=None, **kwargs):
    tfile = renderdump_temp(obj)
    rendererClient(parameters_url=tfile, out_fn=out_fn,
                   subprocess_mode=subprocess_mode,
                   client_script=client_script, memGB=memGB, **kwargs)
    os.remove(tfile)
Пример #3
0
def import_tilespecs(stack, tilespecs, sharedTransforms=None,
                     use_rest=False, deriveData=True,
                     subprocess_mode=None, host=None, port=None,
                     owner=None, project=None, client_script=None,
                     memGB=None, render=None, **kwargs):
    """method to import tilesepcs directly from
    :class:`renderapi.tilespec.TileSpec` objects

    Parameters
    ----------
    stack : str
        stack to which tilespecs will be added
    tilespecs : :obj:`list` of :class:`renderapi.tilespec.TileSpec`
        list of tilespecs to import
    sharedTransforms : :obj:`list` of :class:`renderapi.transform.Transform` or :class:`renderapi.transform.TransformList` or :class:`renderapi.transform.InterpolatedTransform`, optional
        list of shared referenced transforms to be ingested
    use_rest: bool
        whether to import the tilespecs using the post method directly with deriveData=True
    deriveData: bool
        if doing use_rest, will determine whether to have the server calculate bounds (default=True)
    render : renderapi.render.Render
        render connect object

    """  # noqa: E501
    if use_rest:
        put_tilespecs(stack,
                      deriveData=deriveData,
                      tilespecs=tilespecs,
                      shared_transforms=sharedTransforms,
                      host=host, port=port, owner=owner,
                      project=project, **kwargs)
    else:
        tsjson = renderdump_temp(tilespecs)

        if sharedTransforms is not None:
            trjson = renderdump_temp(sharedTransforms)

        importJsonClient(stack, tileFiles=[tsjson], transformFile=(
            trjson if sharedTransforms is not None else None),
            subprocess_mode=subprocess_mode, host=host, port=port,
            owner=owner, project=project,
            client_script=client_script, memGB=memGB, **kwargs)

        os.remove(tsjson)
        if sharedTransforms is not None:
            os.remove(trjson)