shapelib/raster.py
def rasterize(geom, pixratio, xrange=None, yrange=None, imageout=None):
    """
    rasterize the geometry

    geom: a shapely geometry
    pixratio: how many pixels pro unit
              x_pixels / x_size
    xrange, yrange: a selection of the geometry to be rendered,
                    or None to select all. It can be bigger than
                    the geometry itself.
    imageout: if given, it should be the path to save
              the rasterized geometry as a monochrome image

    Backends:
        rasterio, matplotlib

    Returns
    =======

    namedtup(array, imageout) where: 

        array:    2D array of rasterized values, uint8, 0-1
        imageout: filename of generated image or None
    """
    backends = [
        ('rasterio', _rasterize_rasterio),
        ('mastplotlib', _rasterize_matplotlib)
    ]

    for backendname, func in backends:
        out = func(geom, pixratio, xrange, yrange, imageout=imageout)
        if out:
            print("using backend: {backendname}".format(**locals()))
            return out

    rasterize the geometry

    geom: a shapely geometry
    pixratio: how many pixels pro unit
              x_pixels / x_size
    xrange, yrange: a selection of the geometry to be rendered,
                    or None to select all. It can be bigger than
                    the geometry itself.
    imageout: if given, it should be the path to save
              the rasterized geometry as a monochrome image

    Backends:
        rasterio, matplotlib

    Returns
    =======

    namedtup(array, imageout) where: 

        array:    2D array of rasterized values, uint8, 0-1
        imageout: filename of generated image or None
    
rasterize the geometry
geom: a shapely geometry
pixratio: how many pixels pro unit
x_pixels / x_size
xrange, yrange: a selection of the geometry to be rendered,
or None to select all. It can be bigger than
the geometry itself.
imageout: if given, it should be the path to save
the rasterized geometry as a monochrome image

rasterio, matplotlib

Returns



2D array of rasterized values, uint8, 0-1
imageout: filename of generated image or None
rasterize the geometry geom : a shapely geometry pixratio : how many pixels pro unit x_pixels / x_size xrange yrange : a selection of the geometry to be rendered or None to select all . It can be bigger than the geometry itself . imageout : if given it should be the path to save the rasterized geometry as a monochrome image rasterio matplotlib Returns 2D array of rasterized values uint8 0 - 1 imageout : filename of generated image or None
def rasterize(geom, pixratio, xrange=None, yrange=None, imageout=None):
    backends = [
        ('rasterio', _rasterize_rasterio),
        ('mastplotlib', _rasterize_matplotlib)
    ]
    for backendname, func in backends:
        out = func(geom, pixratio, xrange, yrange, imageout=imageout)
        if out:
            print("using backend: {backendname}".format(**locals()))
            return out
def rasterize ( geom , pixratio , xrange = None , yrange = None , imageout = None ) : backends = [ ( 'rasterio' , _rasterize_rasterio ) , ( 'mastplotlib' , _rasterize_matplotlib ) ] for backendname , func in backends : out = func ( geom , pixratio , xrange , yrange , imageout = imageout ) if out : print ( "using backend: {backendname}" . format ( ** locals ( ) ) ) return out
rasterize the geometry
geom: a shapely geometry
pixratio: how many pixels pro unit
x_pixels / x_size
xrange, yrange: a selection of the geometry to be rendered,
or None to select all.
rasterize the geometry geom : a shapely geometry pixratio : how many pixels pro unit x_pixels / x_size xrange yrange : a selection of the geometry to be rendered or None to select all .
"""
    rasterize the geometry

    geom: a shapely geometry
    pixratio: how many pixels pro unit
              x_pixels / x_size
    xrange, yrange: a selection of the geometry to be rendered,
                    or None to select all. It can be bigger than
                    the geometry itself.
    imageout: if given, it should be the path to save
              the rasterized geometry as a monochrome image

    Backends:
        rasterio, matplotlib

    Returns
    =======

    namedtup(array, imageout) where: 

        array:    2D array of rasterized values, uint8, 0-1
        imageout: filename of generated image or None
    """
geom
pixratio
xrange
yrange
imageout